source("pairs.r")
library(dplyr)
library(ggplot2)
library(pastecs)
library(psych)
library(Amelia)
library(mlbench)
library(corrplot)
library(caret)
library(readr)
library(gridExtra)
library(grid)
library(ggplot2)
library(lattice)
library(leaps)
data <- read_csv("data/WA_Fn-UseC_-HR-Employee-Attrition.csv")
Parsed with column specification:
cols(
.default = col_double(),
Attrition = [31mcol_character()[39m,
BusinessTravel = [31mcol_character()[39m,
Department = [31mcol_character()[39m,
EducationField = [31mcol_character()[39m,
Gender = [31mcol_character()[39m,
JobRole = [31mcol_character()[39m,
MaritalStatus = [31mcol_character()[39m,
Over18 = [31mcol_character()[39m,
OverTime = [31mcol_character()[39m
)
See spec(...) for full column specifications.
head(data)
names(data)
[1] "Age" "Attrition" "BusinessTravel" "DailyRate"
[5] "Department" "DistanceFromHome" "Education" "EducationField"
[9] "EmployeeCount" "EmployeeNumber" "EnvironmentSatisfaction" "Gender"
[13] "HourlyRate" "JobInvolvement" "JobLevel" "JobRole"
[17] "JobSatisfaction" "MaritalStatus" "MonthlyIncome" "MonthlyRate"
[21] "NumCompaniesWorked" "Over18" "OverTime" "PercentSalaryHike"
[25] "PerformanceRating" "RelationshipSatisfaction" "StandardHours" "StockOptionLevel"
[29] "TotalWorkingYears" "TrainingTimesLastYear" "WorkLifeBalance" "YearsAtCompany"
[33] "YearsInCurrentRole" "YearsSinceLastPromotion" "YearsWithCurrManager"
summary(data)
Age Attrition BusinessTravel DailyRate Department DistanceFromHome Education
Min. :18.00 Length:1470 Length:1470 Min. : 102.0 Length:1470 Min. : 1.000 Min. :1.000
1st Qu.:30.00 Class :character Class :character 1st Qu.: 465.0 Class :character 1st Qu.: 2.000 1st Qu.:2.000
Median :36.00 Mode :character Mode :character Median : 802.0 Mode :character Median : 7.000 Median :3.000
Mean :36.92 Mean : 802.5 Mean : 9.193 Mean :2.913
3rd Qu.:43.00 3rd Qu.:1157.0 3rd Qu.:14.000 3rd Qu.:4.000
Max. :60.00 Max. :1499.0 Max. :29.000 Max. :5.000
EducationField EmployeeCount EmployeeNumber EnvironmentSatisfaction Gender HourlyRate
Length:1470 Min. :1 Min. : 1.0 Min. :1.000 Length:1470 Min. : 30.00
Class :character 1st Qu.:1 1st Qu.: 491.2 1st Qu.:2.000 Class :character 1st Qu.: 48.00
Mode :character Median :1 Median :1020.5 Median :3.000 Mode :character Median : 66.00
Mean :1 Mean :1024.9 Mean :2.722 Mean : 65.89
3rd Qu.:1 3rd Qu.:1555.8 3rd Qu.:4.000 3rd Qu.: 83.75
Max. :1 Max. :2068.0 Max. :4.000 Max. :100.00
JobInvolvement JobLevel JobRole JobSatisfaction MaritalStatus MonthlyIncome MonthlyRate
Min. :1.00 Min. :1.000 Length:1470 Min. :1.000 Length:1470 Min. : 1009 Min. : 2094
1st Qu.:2.00 1st Qu.:1.000 Class :character 1st Qu.:2.000 Class :character 1st Qu.: 2911 1st Qu.: 8047
Median :3.00 Median :2.000 Mode :character Median :3.000 Mode :character Median : 4919 Median :14236
Mean :2.73 Mean :2.064 Mean :2.729 Mean : 6503 Mean :14313
3rd Qu.:3.00 3rd Qu.:3.000 3rd Qu.:4.000 3rd Qu.: 8379 3rd Qu.:20462
Max. :4.00 Max. :5.000 Max. :4.000 Max. :19999 Max. :26999
NumCompaniesWorked Over18 OverTime PercentSalaryHike PerformanceRating RelationshipSatisfaction
Min. :0.000 Length:1470 Length:1470 Min. :11.00 Min. :3.000 Min. :1.000
1st Qu.:1.000 Class :character Class :character 1st Qu.:12.00 1st Qu.:3.000 1st Qu.:2.000
Median :2.000 Mode :character Mode :character Median :14.00 Median :3.000 Median :3.000
Mean :2.693 Mean :15.21 Mean :3.154 Mean :2.712
3rd Qu.:4.000 3rd Qu.:18.00 3rd Qu.:3.000 3rd Qu.:4.000
Max. :9.000 Max. :25.00 Max. :4.000 Max. :4.000
StandardHours StockOptionLevel TotalWorkingYears TrainingTimesLastYear WorkLifeBalance YearsAtCompany YearsInCurrentRole
Min. :80 Min. :0.0000 Min. : 0.00 Min. :0.000 Min. :1.000 Min. : 0.000 Min. : 0.000
1st Qu.:80 1st Qu.:0.0000 1st Qu.: 6.00 1st Qu.:2.000 1st Qu.:2.000 1st Qu.: 3.000 1st Qu.: 2.000
Median :80 Median :1.0000 Median :10.00 Median :3.000 Median :3.000 Median : 5.000 Median : 3.000
Mean :80 Mean :0.7939 Mean :11.28 Mean :2.799 Mean :2.761 Mean : 7.008 Mean : 4.229
3rd Qu.:80 3rd Qu.:1.0000 3rd Qu.:15.00 3rd Qu.:3.000 3rd Qu.:3.000 3rd Qu.: 9.000 3rd Qu.: 7.000
Max. :80 Max. :3.0000 Max. :40.00 Max. :6.000 Max. :4.000 Max. :40.000 Max. :18.000
YearsSinceLastPromotion YearsWithCurrManager
Min. : 0.000 Min. : 0.000
1st Qu.: 0.000 1st Qu.: 2.000
Median : 1.000 Median : 3.000
Mean : 2.188 Mean : 4.123
3rd Qu.: 3.000 3rd Qu.: 7.000
Max. :15.000 Max. :17.000
#####################################
##
## Reformat the data so that it is
## 1) Easy to use (add nice column names)
## 2) Interpreted correctly by glm()..
##
#####################################
data$Attrition <- ifelse(data$Attrition == "Yes", 1, 0)
data$Attrition <- factor(data$Attrition, levels = c(0, 1))
data$Over18 <- ifelse(data$Over18 == "Y", 1, 0)
data$Over18 <- factor(data$Over18, levels = c(0, 1))
data$OverTime <- ifelse(data$OverTime == "Yes", 1, 0)
data$OverTime <- factor(data$OverTime, levels = c(0, 1))
data$BusinessTravel<-factor(data$BusinessTravel)
data$Department<-factor(data$Department)
data$EducationField<-factor(data$EducationField)
data$Gender<-factor(data$Gender)
data$MaritalStatus<-factor(data$MaritalStatus)
data$JobRole<-factor(data$JobRole)
data$Education<-factor(data$Education, order = TRUE, levels=c(1,2,3,4,5))
data$EnvironmentSatisfaction<-factor(data$EnvironmentSatisfaction, order=TRUE, levels=c(1,2,3,4))
data$JobInvolvement<-factor(data$JobInvolvement, order=TRUE, levels=c(1,2,3,4))
data$JobSatisfaction<-factor(data$JobSatisfaction, order=TRUE, levels=c(1,2,3,4))
data$PerformanceRating<-factor(data$PerformanceRating, order=TRUE, levels=c(1,2,3,4))
data$RelationshipSatisfaction<-factor(data$RelationshipSatisfaction, order=TRUE, levels=c(1,2,3,4))
data$WorkLifeBalance<-factor(data$WorkLifeBalance, order=TRUE, levels=c(1,2,3,4))
data$StockOptionLevel<-factor(data$StockOptionLevel, order=TRUE, levels=c(0,1,2,3))
original.data<-data
stat.desc(data)
describe(data)
str(data)
Classes ‘spec_tbl_df’, ‘tbl_df’, ‘tbl’ and 'data.frame': 1470 obs. of 35 variables:
$ Age : num 41 49 37 33 27 32 59 30 38 36 ...
$ Attrition : Factor w/ 2 levels "0","1": 2 1 2 1 1 1 1 1 1 1 ...
$ BusinessTravel : Factor w/ 3 levels "Non-Travel","Travel_Frequently",..: 3 2 3 2 3 2 3 3 2 3 ...
$ DailyRate : num 1102 279 1373 1392 591 ...
$ Department : Factor w/ 3 levels "Human Resources",..: 3 2 2 2 2 2 2 2 2 2 ...
$ DistanceFromHome : num 1 8 2 3 2 2 3 24 23 27 ...
$ Education : Ord.factor w/ 5 levels "1"<"2"<"3"<"4"<..: 2 1 2 4 1 2 3 1 3 3 ...
$ EducationField : Factor w/ 6 levels "Human Resources",..: 2 2 5 2 4 2 4 2 2 4 ...
$ EmployeeCount : num 1 1 1 1 1 1 1 1 1 1 ...
$ EmployeeNumber : num 1 2 4 5 7 8 10 11 12 13 ...
$ EnvironmentSatisfaction : Ord.factor w/ 4 levels "1"<"2"<"3"<"4": 2 3 4 4 1 4 3 4 4 3 ...
$ Gender : Factor w/ 2 levels "Female","Male": 1 2 2 1 2 2 1 2 2 2 ...
$ HourlyRate : num 94 61 92 56 40 79 81 67 44 94 ...
$ JobInvolvement : Ord.factor w/ 4 levels "1"<"2"<"3"<"4": 3 2 2 3 3 3 4 3 2 3 ...
$ JobLevel : num 2 2 1 1 1 1 1 1 3 2 ...
$ JobRole : Factor w/ 9 levels "Healthcare Representative",..: 8 7 3 7 3 3 3 3 5 1 ...
$ JobSatisfaction : Ord.factor w/ 4 levels "1"<"2"<"3"<"4": 4 2 3 3 2 4 1 3 3 3 ...
$ MaritalStatus : Factor w/ 3 levels "Divorced","Married",..: 3 2 3 2 2 3 2 1 3 2 ...
$ MonthlyIncome : num 5993 5130 2090 2909 3468 ...
$ MonthlyRate : num 19479 24907 2396 23159 16632 ...
$ NumCompaniesWorked : num 8 1 6 1 9 0 4 1 0 6 ...
$ Over18 : Factor w/ 2 levels "0","1": 2 2 2 2 2 2 2 2 2 2 ...
$ OverTime : Factor w/ 2 levels "0","1": 2 1 2 2 1 1 2 1 1 1 ...
$ PercentSalaryHike : num 11 23 15 11 12 13 20 22 21 13 ...
$ PerformanceRating : Ord.factor w/ 4 levels "1"<"2"<"3"<"4": 3 4 3 3 3 3 4 4 4 3 ...
$ RelationshipSatisfaction: Ord.factor w/ 4 levels "1"<"2"<"3"<"4": 1 4 2 3 4 3 1 2 2 2 ...
$ StandardHours : num 80 80 80 80 80 80 80 80 80 80 ...
$ StockOptionLevel : Ord.factor w/ 4 levels "0"<"1"<"2"<"3": 1 2 1 1 2 1 4 2 1 3 ...
$ TotalWorkingYears : num 8 10 7 8 6 8 12 1 10 17 ...
$ TrainingTimesLastYear : num 0 3 3 3 3 2 3 2 2 3 ...
$ WorkLifeBalance : Ord.factor w/ 4 levels "1"<"2"<"3"<"4": 1 3 3 3 3 2 2 3 3 2 ...
$ YearsAtCompany : num 6 10 0 8 2 7 1 1 9 7 ...
$ YearsInCurrentRole : num 4 7 0 7 2 7 0 0 7 7 ...
$ YearsSinceLastPromotion : num 0 1 0 3 2 3 0 0 1 7 ...
$ YearsWithCurrManager : num 5 7 0 0 2 6 0 0 8 7 ...
- attr(*, "spec")=
.. cols(
.. Age = [32mcol_double()[39m,
.. Attrition = [31mcol_character()[39m,
.. BusinessTravel = [31mcol_character()[39m,
.. DailyRate = [32mcol_double()[39m,
.. Department = [31mcol_character()[39m,
.. DistanceFromHome = [32mcol_double()[39m,
.. Education = [32mcol_double()[39m,
.. EducationField = [31mcol_character()[39m,
.. EmployeeCount = [32mcol_double()[39m,
.. EmployeeNumber = [32mcol_double()[39m,
.. EnvironmentSatisfaction = [32mcol_double()[39m,
.. Gender = [31mcol_character()[39m,
.. HourlyRate = [32mcol_double()[39m,
.. JobInvolvement = [32mcol_double()[39m,
.. JobLevel = [32mcol_double()[39m,
.. JobRole = [31mcol_character()[39m,
.. JobSatisfaction = [32mcol_double()[39m,
.. MaritalStatus = [31mcol_character()[39m,
.. MonthlyIncome = [32mcol_double()[39m,
.. MonthlyRate = [32mcol_double()[39m,
.. NumCompaniesWorked = [32mcol_double()[39m,
.. Over18 = [31mcol_character()[39m,
.. OverTime = [31mcol_character()[39m,
.. PercentSalaryHike = [32mcol_double()[39m,
.. PerformanceRating = [32mcol_double()[39m,
.. RelationshipSatisfaction = [32mcol_double()[39m,
.. StandardHours = [32mcol_double()[39m,
.. StockOptionLevel = [32mcol_double()[39m,
.. TotalWorkingYears = [32mcol_double()[39m,
.. TrainingTimesLastYear = [32mcol_double()[39m,
.. WorkLifeBalance = [32mcol_double()[39m,
.. YearsAtCompany = [32mcol_double()[39m,
.. YearsInCurrentRole = [32mcol_double()[39m,
.. YearsSinceLastPromotion = [32mcol_double()[39m,
.. YearsWithCurrManager = [32mcol_double()[39m
.. )
summary(data)
Age Attrition BusinessTravel DailyRate Department DistanceFromHome
Min. :18.00 0:1233 Non-Travel : 150 Min. : 102.0 Human Resources : 63 Min. : 1.000
1st Qu.:30.00 1: 237 Travel_Frequently: 277 1st Qu.: 465.0 Research & Development:961 1st Qu.: 2.000
Median :36.00 Travel_Rarely :1043 Median : 802.0 Sales :446 Median : 7.000
Mean :36.92 Mean : 802.5 Mean : 9.193
3rd Qu.:43.00 3rd Qu.:1157.0 3rd Qu.:14.000
Max. :60.00 Max. :1499.0 Max. :29.000
Education EducationField EmployeeCount EmployeeNumber EnvironmentSatisfaction Gender HourlyRate
1:170 Human Resources : 27 Min. :1 Min. : 1.0 1:284 Female:588 Min. : 30.00
2:282 Life Sciences :606 1st Qu.:1 1st Qu.: 491.2 2:287 Male :882 1st Qu.: 48.00
3:572 Marketing :159 Median :1 Median :1020.5 3:453 Median : 66.00
4:398 Medical :464 Mean :1 Mean :1024.9 4:446 Mean : 65.89
5: 48 Other : 82 3rd Qu.:1 3rd Qu.:1555.8 3rd Qu.: 83.75
Technical Degree:132 Max. :1 Max. :2068.0 Max. :100.00
JobInvolvement JobLevel JobRole JobSatisfaction MaritalStatus MonthlyIncome
1: 83 Min. :1.000 Sales Executive :326 1:289 Divorced:327 Min. : 1009
2:375 1st Qu.:1.000 Research Scientist :292 2:280 Married :673 1st Qu.: 2911
3:868 Median :2.000 Laboratory Technician :259 3:442 Single :470 Median : 4919
4:144 Mean :2.064 Manufacturing Director :145 4:459 Mean : 6503
3rd Qu.:3.000 Healthcare Representative:131 3rd Qu.: 8379
Max. :5.000 Manager :102 Max. :19999
(Other) :215
MonthlyRate NumCompaniesWorked Over18 OverTime PercentSalaryHike PerformanceRating RelationshipSatisfaction
Min. : 2094 Min. :0.000 0: 0 0:1054 Min. :11.00 1: 0 1:276
1st Qu.: 8047 1st Qu.:1.000 1:1470 1: 416 1st Qu.:12.00 2: 0 2:303
Median :14236 Median :2.000 Median :14.00 3:1244 3:459
Mean :14313 Mean :2.693 Mean :15.21 4: 226 4:432
3rd Qu.:20462 3rd Qu.:4.000 3rd Qu.:18.00
Max. :26999 Max. :9.000 Max. :25.00
StandardHours StockOptionLevel TotalWorkingYears TrainingTimesLastYear WorkLifeBalance YearsAtCompany YearsInCurrentRole
Min. :80 0:631 Min. : 0.00 Min. :0.000 1: 80 Min. : 0.000 Min. : 0.000
1st Qu.:80 1:596 1st Qu.: 6.00 1st Qu.:2.000 2:344 1st Qu.: 3.000 1st Qu.: 2.000
Median :80 2:158 Median :10.00 Median :3.000 3:893 Median : 5.000 Median : 3.000
Mean :80 3: 85 Mean :11.28 Mean :2.799 4:153 Mean : 7.008 Mean : 4.229
3rd Qu.:80 3rd Qu.:15.00 3rd Qu.:3.000 3rd Qu.: 9.000 3rd Qu.: 7.000
Max. :80 Max. :40.00 Max. :6.000 Max. :40.000 Max. :18.000
YearsSinceLastPromotion YearsWithCurrManager
Min. : 0.000 Min. : 0.000
1st Qu.: 0.000 1st Qu.: 2.000
Median : 1.000 Median : 3.000
Mean : 2.188 Mean : 4.123
3rd Qu.: 3.000 3rd Qu.: 7.000
Max. :15.000 Max. :17.000
for(i in 1:length(data)) {
plot(data$Attrition, eval(parse(text=paste("data",names(data)[i],sep="$"))), xlab = "Attrition", ylab = names(data)[i])
}
help(missmap)
options(repr.plot.width = 24, repr.plot.height = 24)
missmap(data, col=c("blue", "red"), legend=TRUE)
the condition has length > 1 and only the first element will be usedUnknown or uninitialised column: 'arguments'.Unknown or uninitialised column: 'arguments'.Unknown or uninitialised column: 'imputations'.
options(repr.plot.width = 16, repr.plot.height = 16)
num_data <- data[, sapply(data, is.numeric)]
stat.desc(num_data)
correlations <- cor(num_data)
the standard deviation is zero
corrplot(correlations, method="circle")
# View(data)
plot(data[c(2,1,3,4,5)])
plot(data[c(2,6,7,8,9)])
plot(data[c(2,10,11,12,13)])
plot(data[c(2,14,15,16,17)])
plot(data[c(2,18,19,20,21)])
plot(data[c(2,22,23,24,25)])
plot(data[c(2,26,27,28,29)])
plot(data[c(2,30,31,32,33)])
plot(data[c(2,34,35)])
cat_data <- data[, sapply(data, is.factor)]
summary(cat_data)
Attrition BusinessTravel Department Education EducationField EnvironmentSatisfaction
0:1233 Non-Travel : 150 Human Resources : 63 1:170 Human Resources : 27 1:284
1: 237 Travel_Frequently: 277 Research & Development:961 2:282 Life Sciences :606 2:287
Travel_Rarely :1043 Sales :446 3:572 Marketing :159 3:453
4:398 Medical :464 4:446
5: 48 Other : 82
Technical Degree:132
Gender JobInvolvement JobRole JobSatisfaction MaritalStatus Over18 OverTime
Female:588 1: 83 Sales Executive :326 1:289 Divorced:327 0: 0 0:1054
Male :882 2:375 Research Scientist :292 2:280 Married :673 1:1470 1: 416
3:868 Laboratory Technician :259 3:442 Single :470
4:144 Manufacturing Director :145 4:459
Healthcare Representative:131
Manager :102
(Other) :215
PerformanceRating RelationshipSatisfaction StockOptionLevel WorkLifeBalance
1: 0 1:276 0:631 1: 80
2: 0 2:303 1:596 2:344
3:1244 3:459 2:158 3:893
4: 226 4:432 3: 85 4:153
ggplot(data=data, aes(Attrition)) + geom_histogram(stat="count") + labs(x="Attrition")
Ignoring unknown parameters: binwidth, bins, pad
ggplot(data=data, aes(Age)) + geom_histogram(binwidth=5) + labs(x="Age")
ggplot(data=data, aes(BusinessTravel)) + geom_histogram(stat="count") + labs(x="Business Travel")
Ignoring unknown parameters: binwidth, bins, pad
ggplot(data=data, aes(DailyRate)) + geom_histogram(binwidth=15) + labs(x="Daily Rate")
ggplot(data=data, aes(Department)) + geom_histogram(stat="count") + labs(x="Department")
Ignoring unknown parameters: binwidth, bins, pad
ggplot(data=data, aes(DistanceFromHome)) + geom_histogram(binwidth=5) + labs(x="Distance from Home")
ggplot(data=data, aes(Education)) + geom_histogram(stat="count") + labs(x="Education")
Ignoring unknown parameters: binwidth, bins, pad
ggplot(data=data, aes(EducationField)) + geom_histogram(stat="count") + labs(x="Education Field")
Ignoring unknown parameters: binwidth, bins, pad
ggplot(data=data, aes(EmployeeCount)) + geom_histogram(binwidth=1) + labs(x="Employee Count")
ggplot(data=data, aes(EmployeeNumber)) + geom_histogram(binwidth=20) + labs(x="Employee Number")
ggplot(data=data, aes(EnvironmentSatisfaction)) + geom_histogram(stat="count") + labs(x="Environment Satisfaction")
Ignoring unknown parameters: binwidth, bins, pad
ggplot(data=data, aes(Gender)) + geom_histogram(stat="count") + labs(x="Gender")
Ignoring unknown parameters: binwidth, bins, pad
ggplot(data=data, aes(HourlyRate)) + geom_histogram(binwidth=5) + labs(x="Hourly Rate")
ggplot(data=data, aes(JobInvolvement)) + geom_histogram(stat="count") + labs(x="Job Involvement")
Ignoring unknown parameters: binwidth, bins, pad
ggplot(data=data, aes(JobLevel)) + geom_histogram(stat="count") + labs(x="Job Level")
Ignoring unknown parameters: binwidth, bins, pad
ggplot(data=data, aes(JobRole)) + geom_histogram(stat="count") + labs(x="Job Role")
Ignoring unknown parameters: binwidth, bins, pad
ggplot(data=data, aes(JobSatisfaction)) + geom_histogram(stat="count") + labs(x="Job Satisfaction")
Ignoring unknown parameters: binwidth, bins, pad
ggplot(data=data, aes(MaritalStatus)) + geom_histogram(stat="count") + labs(x="Marital Status")
Ignoring unknown parameters: binwidth, bins, pad
ggplot(data=data, aes(MonthlyIncome)) + geom_histogram(binwidth=50) + labs(x="Monthly Income")
ggplot(data=data, aes(MonthlyRate)) + geom_histogram(binwidth=50) + labs(x="Monthly Rate")
ggplot(data=data, aes(NumCompaniesWorked)) + geom_histogram(binwidth=1) + labs(x="Num Companies Worked")
ggplot(data=data, aes(Over18)) + geom_histogram(stat="count") + labs(x="Over 18")
Ignoring unknown parameters: binwidth, bins, pad
ggplot(data=data, aes(PercentSalaryHike)) + geom_histogram(binwidth=5) + labs(x="Percent Salary Hike")
ggplot(data=data, aes(PerformanceRating)) + geom_histogram(stat="count") + labs(x="Performance Rating")
Ignoring unknown parameters: binwidth, bins, pad
ggplot(data=data, aes(RelationshipSatisfaction)) + geom_histogram(stat="count") + labs(x="Relationship Satisfaction")
Ignoring unknown parameters: binwidth, bins, pad
ggplot(data=data, aes(StandardHours)) + geom_histogram(binwidth=5) + labs(x="Standard Hours")
ggplot(data=data, aes(StockOptionLevel)) + geom_histogram(stat="count") + labs(x="Stock Option Level")
Ignoring unknown parameters: binwidth, bins, pad
ggplot(data=data, aes(TotalWorkingYears)) + geom_histogram(binwidth=5) + labs(x="Total Working Years")
ggplot(data=data, aes(TrainingTimesLastYear)) + geom_histogram(binwidth=5) + labs(x="Training Times Last Year")
ggplot(data=data, aes(WorkLifeBalance)) + geom_histogram(stat="count") + labs(x="Work Life Balance")
Ignoring unknown parameters: binwidth, bins, pad
ggplot(data=data, aes(YearsAtCompany)) + geom_histogram(binwidth=2) + labs(x="Years At Company")
ggplot(data=data, aes(YearsSinceLastPromotion)) + geom_histogram(binwidth=2) + labs(x="Years Since Last Promotion")
ggplot(data=data, aes(YearsWithCurrManager)) + geom_histogram(binwidth=2) + labs(x="Years With Curr Manager")
#######################################
## BUILD OUR LOGISTIC MODEL - logmod
#######################################
# xtabs(~Attrition + Age, data=data)
xtabs(~Attrition + BusinessTravel, data=data)
BusinessTravel
Attrition Non-Travel Travel_Frequently Travel_Rarely
0 138 208 887
1 12 69 156
# xtabs(~Attrition + DailyRate, data=data)
xtabs(~Attrition + factor(Department), data=data)
factor(Department)
Attrition Human Resources Research & Development Sales
0 51 828 354
1 12 133 92
# xtabs(~Attrition + DistanceFromHome, data=data)
xtabs(~Attrition + factor(Education), data=data)
factor(Education)
Attrition 1 2 3 4 5
0 139 238 473 340 43
1 31 44 99 58 5
xtabs(~Attrition + EducationField, data=data)
EducationField
Attrition Human Resources Life Sciences Marketing Medical Other Technical Degree
0 20 517 124 401 71 100
1 7 89 35 63 11 32
xtabs(~Attrition + EmployeeCount, data=data)
EmployeeCount
Attrition 1
0 1233
1 237
# xtabs(~Attrition + EmployeeNumber, data=data)
xtabs(~Attrition + factor(EnvironmentSatisfaction), data=data)
factor(EnvironmentSatisfaction)
Attrition 1 2 3 4
0 212 244 391 386
1 72 43 62 60
xtabs(~Attrition + factor(Gender), data=data)
factor(Gender)
Attrition Female Male
0 501 732
1 87 150
# xtabs(~Attrition + HourlyRate, data=data)
xtabs(~Attrition + factor(JobInvolvement), data=data)
factor(JobInvolvement)
Attrition 1 2 3 4
0 55 304 743 131
1 28 71 125 13
xtabs(~Attrition + factor(JobLevel), data=data)
factor(JobLevel)
Attrition 1 2 3 4 5
0 400 482 186 101 64
1 143 52 32 5 5
xtabs(~Attrition + factor(JobRole), data=data)
factor(JobRole)
Attrition Healthcare Representative Human Resources Laboratory Technician Manager Manufacturing Director Research Director
0 122 40 197 97 135 78
1 9 12 62 5 10 2
factor(JobRole)
Attrition Research Scientist Sales Executive Sales Representative
0 245 269 50
1 47 57 33
xtabs(~Attrition + factor(JobSatisfaction), data=data)
factor(JobSatisfaction)
Attrition 1 2 3 4
0 223 234 369 407
1 66 46 73 52
xtabs(~Attrition + factor(MaritalStatus), data=data)
factor(MaritalStatus)
Attrition Divorced Married Single
0 294 589 350
1 33 84 120
# xtabs(~Attrition + MonthlyIncome, data=data)
# xtabs(~Attrition + MonthlyRate, data=data)
xtabs(~Attrition + NumCompaniesWorked, data=data)
NumCompaniesWorked
Attrition 0 1 2 3 4 5 6 7 8 9
0 174 423 130 143 122 47 54 57 43 40
1 23 98 16 16 17 16 16 17 6 12
xtabs(~Attrition + factor(OverTime), data=data)
factor(OverTime)
Attrition 0 1
0 944 289
1 110 127
# xtabs(~Attrition + PercentSalaryHike, data=data)
xtabs(~Attrition + factor(PerformanceRating), data=data)
factor(PerformanceRating)
Attrition 3 4
0 1044 189
1 200 37
xtabs(~Attrition + factor(RelationshipSatisfaction), data=data)
factor(RelationshipSatisfaction)
Attrition 1 2 3 4
0 219 258 388 368
1 57 45 71 64
xtabs(~Attrition + StandardHours, data=data)
StandardHours
Attrition 80
0 1233
1 237
xtabs(~Attrition + factor(StockOptionLevel), data=data)
factor(StockOptionLevel)
Attrition 0 1 2 3
0 477 540 146 70
1 154 56 12 15
# xtabs(~Attrition + TotalWorkingYears, data=data)
xtabs(~Attrition + TrainingTimesLastYear, data=data)
TrainingTimesLastYear
Attrition 0 1 2 3 4 5 6
0 39 62 449 422 97 105 59
1 15 9 98 69 26 14 6
xtabs(~Attrition + factor(WorkLifeBalance), data=data)
factor(WorkLifeBalance)
Attrition 1 2 3 4
0 55 286 766 126
1 25 58 127 27
# xtabs(~Attrition + YearsAtCompany, data=data)
# xtabs(~Attrition + YearsSinceLastPromotion, data=data)
# xtabs(~Attrition + YearsWithCurrManager, data=data)
When we plot the histogram of Attrition, we immediate observe an unbalanced dataset where the minority value is 1 corresponding to employees leaving an organization.
data<-original.data
ggplot(data=data, aes(Attrition)) + geom_histogram(stat="count") + labs(x="Attrition")
Ignoring unknown parameters: binwidth, bins, pad
To compensate for this, we use a technique called over/undersampling using the ROSE library which results on a balanced dataset.
#balancing data:
#what to do if number of 1's is much smaller than the number of 0's
#find the indeces corresponding to 0s, and 1's
input_ones <- data[which(data$Attrition == 1), ] # all 1's
input_zeros <- data[which(data$Attrition == 0), ] # all 0's
#reduce the number of 0's by selecting a sample at random of the size of the 1's you have.
#you can have a different proportion. I made it 50:50 but use your judgement.
#Perhaps you want 1:2 ratio to include more cases.
#set.seed(100) # for repeatability of samples
#which.zeros<- sample(1:nrow(input_zeros), nrow(input_ones))
#sample.from.zeros<-input_zeros[which.zeros,]
#put the data together:
#balanced.data<-rbind(input_ones,sample.from.zeros)
#Altenatively, you can leave the zeros as they are and resample the 1's
#set.seed(100) # for repeatability of samples
#which.ones<- sample(1:2*nrow(input_ones), nrow(input_zeros),replace=TRUE)
#resample.ones<-input_ones[which.ones,]
#balanced.data<-rbind(resample.ones,input_zeros)
#another way: sake a sample of the same zise for both (p=.5), total samples=3000
# "both" oversamples minority(1's) and undersamples mayority(0's)
library(ROSE)
balanced.data<-ovun.sample(Attrition~.,data=data,method="both",p=0.5,N=3000,seed=1)$data
#####################################
##
## Now we will use all of the data available to predict attrition
##
#####################################
data<-balanced.data
logmod <- glm(
factor(Attrition) ~
Age
+ factor(BusinessTravel) * DistanceFromHome * factor(MaritalStatus) * factor(WorkLifeBalance)
+ DailyRate
+ factor(Department)
+ factor(Education) * EducationField
+ factor(JobInvolvement) * factor(JobLevel) * factor(JobSatisfaction)
+ factor(EnvironmentSatisfaction) * factor(Gender) * factor(JobRole)
+ MonthlyIncome * HourlyRate * factor(OverTime)
+ NumCompaniesWorked
+ factor(PerformanceRating)
+ factor(RelationshipSatisfaction)
+ factor(StockOptionLevel) * TotalWorkingYears * TrainingTimesLastYear
+ PercentSalaryHike * YearsAtCompany * YearsSinceLastPromotion * YearsWithCurrManager
, data=data
, family=binomial
)
glm.fit: fitted probabilities numerically 0 or 1 occurred
summary(logmod)
Call:
glm(formula = factor(Attrition) ~ Age + factor(BusinessTravel) *
DistanceFromHome * factor(MaritalStatus) * factor(WorkLifeBalance) +
DailyRate + factor(Department) + factor(Education) * EducationField +
factor(JobInvolvement) * factor(JobLevel) * factor(JobSatisfaction) +
factor(EnvironmentSatisfaction) * factor(Gender) * factor(JobRole) +
MonthlyIncome * HourlyRate * factor(OverTime) + NumCompaniesWorked +
factor(PerformanceRating) + factor(RelationshipSatisfaction) +
factor(StockOptionLevel) * TotalWorkingYears * TrainingTimesLastYear +
PercentSalaryHike * YearsAtCompany * YearsSinceLastPromotion *
YearsWithCurrManager, family = binomial, data = data)
Deviance Residuals:
Min 1Q Median 3Q Max
-4.2992 -0.0216 0.0000 0.1645 4.6607
Coefficients: (6 not defined because of singularities)
Estimate
(Intercept) -1.535e+00
Age -7.520e-02
factor(BusinessTravel)Travel_Frequently -4.180e+01
factor(BusinessTravel)Travel_Rarely -4.928e+01
DistanceFromHome -5.956e+00
factor(MaritalStatus)Married -1.359e+02
factor(MaritalStatus)Single -3.879e+02
factor(WorkLifeBalance).L 2.070e+01
factor(WorkLifeBalance).Q 1.130e+02
factor(WorkLifeBalance).C 4.535e+00
DailyRate -1.039e-03
factor(Department)Research & Development 3.291e+01
factor(Department)Sales -2.953e+01
factor(Education).L 1.204e+01
factor(Education).Q 3.154e+00
factor(Education).C -3.673e+01
factor(Education)^4 5.191e+00
EducationFieldLife Sciences -8.754e+00
EducationFieldMarketing -2.985e+00
EducationFieldMedical -7.635e+00
EducationFieldOther -8.790e+00
EducationFieldTechnical Degree -1.937e+00
factor(JobInvolvement).L -1.478e+01
factor(JobInvolvement).Q 2.059e+00
factor(JobInvolvement).C -5.251e+00
factor(JobLevel)2 -5.840e+00
factor(JobLevel)3 -1.257e+01
factor(JobLevel)4 3.089e+01
factor(JobLevel)5 4.207e+01
factor(JobSatisfaction).L -1.002e+01
factor(JobSatisfaction).Q -1.355e+00
factor(JobSatisfaction).C 2.254e-01
factor(EnvironmentSatisfaction).L 2.702e+00
factor(EnvironmentSatisfaction).Q 2.352e+01
factor(EnvironmentSatisfaction).C -1.802e+01
factor(Gender)Male -5.997e+00
factor(JobRole)Human Resources 4.545e+01
factor(JobRole)Laboratory Technician 9.171e+00
factor(JobRole)Manager -3.780e+01
factor(JobRole)Manufacturing Director -1.339e+01
factor(JobRole)Research Director -2.024e+01
factor(JobRole)Research Scientist 6.663e+00
factor(JobRole)Sales Executive 7.146e+01
factor(JobRole)Sales Representative 7.792e+01
MonthlyIncome -5.959e-04
HourlyRate -1.282e-02
factor(OverTime)1 -2.701e-01
NumCompaniesWorked 4.517e-01
factor(PerformanceRating).L -7.197e-01
factor(RelationshipSatisfaction).L -2.327e+00
factor(RelationshipSatisfaction).Q 8.479e-01
factor(RelationshipSatisfaction).C -4.318e-01
factor(StockOptionLevel).L 7.115e-01
factor(StockOptionLevel).Q 7.312e-01
factor(StockOptionLevel).C -4.657e+00
TotalWorkingYears -3.316e-01
TrainingTimesLastYear -1.303e+00
PercentSalaryHike 1.781e-01
YearsAtCompany 6.439e-01
YearsSinceLastPromotion -6.079e-01
YearsWithCurrManager -2.468e+00
factor(BusinessTravel)Travel_Frequently:DistanceFromHome 6.475e+00
factor(BusinessTravel)Travel_Rarely:DistanceFromHome 7.487e+00
factor(BusinessTravel)Travel_Frequently:factor(MaritalStatus)Married 1.544e+02
factor(BusinessTravel)Travel_Rarely:factor(MaritalStatus)Married 1.520e+02
factor(BusinessTravel)Travel_Frequently:factor(MaritalStatus)Single 3.990e+02
factor(BusinessTravel)Travel_Rarely:factor(MaritalStatus)Single 4.053e+02
DistanceFromHome:factor(MaritalStatus)Married 1.103e+01
DistanceFromHome:factor(MaritalStatus)Single 3.673e+01
factor(BusinessTravel)Travel_Frequently:factor(WorkLifeBalance).L -2.801e+01
factor(BusinessTravel)Travel_Rarely:factor(WorkLifeBalance).L 2.687e+01
factor(BusinessTravel)Travel_Frequently:factor(WorkLifeBalance).Q -1.380e+02
factor(BusinessTravel)Travel_Rarely:factor(WorkLifeBalance).Q -1.368e+02
factor(BusinessTravel)Travel_Frequently:factor(WorkLifeBalance).C -2.084e+00
factor(BusinessTravel)Travel_Rarely:factor(WorkLifeBalance).C 9.587e+00
DistanceFromHome:factor(WorkLifeBalance).L -2.305e+00
DistanceFromHome:factor(WorkLifeBalance).Q -1.152e+01
DistanceFromHome:factor(WorkLifeBalance).C -2.275e-02
factor(MaritalStatus)Married:factor(WorkLifeBalance).L 6.706e+01
factor(MaritalStatus)Single:factor(WorkLifeBalance).L 7.344e+02
factor(MaritalStatus)Married:factor(WorkLifeBalance).Q 3.794e+01
factor(MaritalStatus)Single:factor(WorkLifeBalance).Q -5.253e+02
factor(MaritalStatus)Married:factor(WorkLifeBalance).C -2.398e+02
factor(MaritalStatus)Single:factor(WorkLifeBalance).C 3.566e+01
factor(Education).L:EducationFieldLife Sciences -2.240e+01
factor(Education).Q:EducationFieldLife Sciences -1.529e+01
factor(Education).C:EducationFieldLife Sciences 3.153e+01
factor(Education)^4:EducationFieldLife Sciences -8.096e+00
factor(Education).L:EducationFieldMarketing -1.366e+01
factor(Education).Q:EducationFieldMarketing -3.780e+00
factor(Education).C:EducationFieldMarketing 3.758e+01
factor(Education)^4:EducationFieldMarketing -4.943e+00
factor(Education).L:EducationFieldMedical -2.542e+01
factor(Education).Q:EducationFieldMedical -1.424e+01
factor(Education).C:EducationFieldMedical 3.178e+01
factor(Education)^4:EducationFieldMedical -9.096e+00
factor(Education).L:EducationFieldOther -1.996e+01
factor(Education).Q:EducationFieldOther -1.265e+01
factor(Education).C:EducationFieldOther 2.895e+01
factor(Education)^4:EducationFieldOther -7.194e+00
factor(Education).L:EducationFieldTechnical Degree -5.854e+00
factor(Education).Q:EducationFieldTechnical Degree -9.808e-01
factor(Education).C:EducationFieldTechnical Degree 3.912e+01
factor(Education)^4:EducationFieldTechnical Degree -1.405e+00
factor(JobInvolvement).L:factor(JobLevel)2 1.905e+00
factor(JobInvolvement).Q:factor(JobLevel)2 -8.234e+00
factor(JobInvolvement).C:factor(JobLevel)2 9.556e-01
factor(JobInvolvement).L:factor(JobLevel)3 3.320e+01
factor(JobInvolvement).Q:factor(JobLevel)3 -2.303e+01
factor(JobInvolvement).C:factor(JobLevel)3 7.732e+00
factor(JobInvolvement).L:factor(JobLevel)4 -1.222e+02
factor(JobInvolvement).Q:factor(JobLevel)4 8.435e+01
factor(JobInvolvement).C:factor(JobLevel)4 -4.981e+01
factor(JobInvolvement).L:factor(JobLevel)5 -4.489e+01
factor(JobInvolvement).Q:factor(JobLevel)5 4.742e+01
factor(JobInvolvement).C:factor(JobLevel)5 9.177e+00
factor(JobInvolvement).L:factor(JobSatisfaction).L 2.917e+00
factor(JobInvolvement).Q:factor(JobSatisfaction).L -1.720e+01
factor(JobInvolvement).C:factor(JobSatisfaction).L 4.372e+00
factor(JobInvolvement).L:factor(JobSatisfaction).Q -1.067e+01
factor(JobInvolvement).Q:factor(JobSatisfaction).Q -4.142e+00
factor(JobInvolvement).C:factor(JobSatisfaction).Q -2.620e+00
factor(JobInvolvement).L:factor(JobSatisfaction).C -8.234e+00
factor(JobInvolvement).Q:factor(JobSatisfaction).C 3.467e+00
factor(JobInvolvement).C:factor(JobSatisfaction).C -2.045e+00
factor(JobLevel)2:factor(JobSatisfaction).L 8.128e+00
factor(JobLevel)3:factor(JobSatisfaction).L 2.422e+01
factor(JobLevel)4:factor(JobSatisfaction).L -1.605e+01
factor(JobLevel)5:factor(JobSatisfaction).L -5.998e+01
factor(JobLevel)2:factor(JobSatisfaction).Q -3.798e+00
factor(JobLevel)3:factor(JobSatisfaction).Q 1.492e+01
factor(JobLevel)4:factor(JobSatisfaction).Q 6.708e+01
factor(JobLevel)5:factor(JobSatisfaction).Q 2.263e+01
factor(JobLevel)2:factor(JobSatisfaction).C -4.324e+00
factor(JobLevel)3:factor(JobSatisfaction).C 5.987e+00
factor(JobLevel)4:factor(JobSatisfaction).C -2.129e+01
factor(JobLevel)5:factor(JobSatisfaction).C 3.669e+01
factor(EnvironmentSatisfaction).L:factor(Gender)Male -2.355e+01
factor(EnvironmentSatisfaction).Q:factor(Gender)Male -2.093e+01
factor(EnvironmentSatisfaction).C:factor(Gender)Male 3.403e+01
factor(EnvironmentSatisfaction).L:factor(JobRole)Human Resources -1.099e+01
factor(EnvironmentSatisfaction).Q:factor(JobRole)Human Resources -2.646e+01
factor(EnvironmentSatisfaction).C:factor(JobRole)Human Resources 2.975e+01
factor(EnvironmentSatisfaction).L:factor(JobRole)Laboratory Technician -5.865e+00
factor(EnvironmentSatisfaction).Q:factor(JobRole)Laboratory Technician -2.485e+01
factor(EnvironmentSatisfaction).C:factor(JobRole)Laboratory Technician 1.883e+01
factor(EnvironmentSatisfaction).L:factor(JobRole)Manager 1.281e+01
factor(EnvironmentSatisfaction).Q:factor(JobRole)Manager -2.689e+01
factor(EnvironmentSatisfaction).C:factor(JobRole)Manager 2.203e+01
factor(EnvironmentSatisfaction).L:factor(JobRole)Manufacturing Director -1.485e+01
factor(EnvironmentSatisfaction).Q:factor(JobRole)Manufacturing Director -6.357e+01
factor(EnvironmentSatisfaction).C:factor(JobRole)Manufacturing Director 1.689e+01
factor(EnvironmentSatisfaction).L:factor(JobRole)Research Director -2.918e+01
factor(EnvironmentSatisfaction).Q:factor(JobRole)Research Director -4.001e+01
factor(EnvironmentSatisfaction).C:factor(JobRole)Research Director 1.008e+02
factor(EnvironmentSatisfaction).L:factor(JobRole)Research Scientist -5.404e+00
factor(EnvironmentSatisfaction).Q:factor(JobRole)Research Scientist -1.895e+01
factor(EnvironmentSatisfaction).C:factor(JobRole)Research Scientist 1.364e+01
factor(EnvironmentSatisfaction).L:factor(JobRole)Sales Executive -4.536e+00
factor(EnvironmentSatisfaction).Q:factor(JobRole)Sales Executive -2.093e+01
factor(EnvironmentSatisfaction).C:factor(JobRole)Sales Executive 1.876e+01
factor(EnvironmentSatisfaction).L:factor(JobRole)Sales Representative -1.972e+01
factor(EnvironmentSatisfaction).Q:factor(JobRole)Sales Representative -1.461e+01
factor(EnvironmentSatisfaction).C:factor(JobRole)Sales Representative 1.326e+01
factor(Gender)Male:factor(JobRole)Human Resources -4.406e+00
factor(Gender)Male:factor(JobRole)Laboratory Technician 8.017e+00
factor(Gender)Male:factor(JobRole)Manager 3.934e+01
factor(Gender)Male:factor(JobRole)Manufacturing Director 2.813e+01
factor(Gender)Male:factor(JobRole)Research Director -4.012e+01
factor(Gender)Male:factor(JobRole)Research Scientist 7.909e+00
factor(Gender)Male:factor(JobRole)Sales Executive 7.983e+00
factor(Gender)Male:factor(JobRole)Sales Representative 2.415e+00
MonthlyIncome:HourlyRate 1.255e-05
MonthlyIncome:factor(OverTime)1 1.487e-03
HourlyRate:factor(OverTime)1 1.169e-01
factor(StockOptionLevel).L:TotalWorkingYears 3.423e-01
factor(StockOptionLevel).Q:TotalWorkingYears 8.717e-01
factor(StockOptionLevel).C:TotalWorkingYears 7.281e-01
factor(StockOptionLevel).L:TrainingTimesLastYear -1.498e+00
factor(StockOptionLevel).Q:TrainingTimesLastYear 8.355e-01
factor(StockOptionLevel).C:TrainingTimesLastYear 1.420e+00
TotalWorkingYears:TrainingTimesLastYear 2.876e-02
PercentSalaryHike:YearsAtCompany -2.883e-02
PercentSalaryHike:YearsSinceLastPromotion -3.987e-02
YearsAtCompany:YearsSinceLastPromotion 7.735e-02
PercentSalaryHike:YearsWithCurrManager 1.015e-01
YearsAtCompany:YearsWithCurrManager 6.455e-02
YearsSinceLastPromotion:YearsWithCurrManager 3.746e-01
factor(BusinessTravel)Travel_Frequently:DistanceFromHome:factor(MaritalStatus)Married -1.329e+01
factor(BusinessTravel)Travel_Rarely:DistanceFromHome:factor(MaritalStatus)Married -1.250e+01
factor(BusinessTravel)Travel_Frequently:DistanceFromHome:factor(MaritalStatus)Single -3.682e+01
factor(BusinessTravel)Travel_Rarely:DistanceFromHome:factor(MaritalStatus)Single -3.818e+01
factor(BusinessTravel)Travel_Frequently:DistanceFromHome:factor(WorkLifeBalance).L 1.551e+00
factor(BusinessTravel)Travel_Rarely:DistanceFromHome:factor(WorkLifeBalance).L -2.551e+00
factor(BusinessTravel)Travel_Frequently:DistanceFromHome:factor(WorkLifeBalance).Q 1.271e+01
factor(BusinessTravel)Travel_Rarely:DistanceFromHome:factor(WorkLifeBalance).Q 1.429e+01
factor(BusinessTravel)Travel_Frequently:DistanceFromHome:factor(WorkLifeBalance).C -4.503e-01
factor(BusinessTravel)Travel_Rarely:DistanceFromHome:factor(WorkLifeBalance).C -1.379e+00
factor(BusinessTravel)Travel_Frequently:factor(MaritalStatus)Married:factor(WorkLifeBalance).L -8.620e+01
factor(BusinessTravel)Travel_Rarely:factor(MaritalStatus)Married:factor(WorkLifeBalance).L -1.140e+02
Std. Error
(Intercept) 7.278e+04
Age 1.875e-02
factor(BusinessTravel)Travel_Frequently 7.302e+04
factor(BusinessTravel)Travel_Rarely 7.218e+04
DistanceFromHome 9.188e+03
factor(MaritalStatus)Married 7.389e+04
factor(MaritalStatus)Single 1.960e+05
factor(WorkLifeBalance).L 1.917e+05
factor(WorkLifeBalance).Q 1.437e+05
factor(WorkLifeBalance).C 6.756e+04
DailyRate 3.491e-04
factor(Department)Research & Development 1.057e+04
factor(Department)Sales 1.084e+04
factor(Education).L 7.332e+03
factor(Education).Q 6.196e+03
factor(Education).C 1.466e+04
factor(Education)^4 1.108e+04
EducationFieldLife Sciences 4.875e+03
EducationFieldMarketing 4.637e+03
EducationFieldMedical 4.844e+03
EducationFieldOther 8.244e+03
EducationFieldTechnical Degree 4.637e+03
factor(JobInvolvement).L 2.693e+03
factor(JobInvolvement).Q 2.007e+03
factor(JobInvolvement).C 8.977e+02
factor(JobLevel)2 1.358e+03
factor(JobLevel)3 4.612e+03
factor(JobLevel)4 2.315e+04
factor(JobLevel)5 2.067e+04
factor(JobSatisfaction).L 1.959e+03
factor(JobSatisfaction).Q 2.007e+03
factor(JobSatisfaction).C 2.054e+03
factor(EnvironmentSatisfaction).L 2.252e+03
factor(EnvironmentSatisfaction).Q 5.036e+03
factor(EnvironmentSatisfaction).C 6.757e+03
factor(Gender)Male 3.218e+03
factor(JobRole)Human Resources 1.124e+04
factor(JobRole)Laboratory Technician 2.518e+03
factor(JobRole)Manager 4.660e+03
factor(JobRole)Manufacturing Director 4.202e+03
factor(JobRole)Research Director 5.641e+03
factor(JobRole)Research Scientist 2.518e+03
factor(JobRole)Sales Executive 4.711e+03
factor(JobRole)Sales Representative 5.760e+03
MonthlyIncome 2.768e-04
HourlyRate 1.736e-02
factor(OverTime)1 1.931e+00
NumCompaniesWorked 6.664e-02
factor(PerformanceRating).L 4.410e-01
factor(RelationshipSatisfaction).L 3.001e-01
factor(RelationshipSatisfaction).Q 2.949e-01
factor(RelationshipSatisfaction).C 2.935e-01
factor(StockOptionLevel).L 3.029e+00
factor(StockOptionLevel).Q 2.906e+00
factor(StockOptionLevel).C 2.648e+00
TotalWorkingYears 1.452e-01
TrainingTimesLastYear 4.801e-01
PercentSalaryHike 9.609e-02
YearsAtCompany 4.125e-01
YearsSinceLastPromotion 1.262e+00
YearsWithCurrManager 6.778e-01
factor(BusinessTravel)Travel_Frequently:DistanceFromHome 9.250e+03
factor(BusinessTravel)Travel_Rarely:DistanceFromHome 9.209e+03
factor(BusinessTravel)Travel_Frequently:factor(MaritalStatus)Married 7.516e+04
factor(BusinessTravel)Travel_Rarely:factor(MaritalStatus)Married 7.421e+04
factor(BusinessTravel)Travel_Frequently:factor(MaritalStatus)Single 1.964e+05
factor(BusinessTravel)Travel_Rarely:factor(MaritalStatus)Single 1.958e+05
DistanceFromHome:factor(MaritalStatus)Married 9.517e+03
DistanceFromHome:factor(MaritalStatus)Single 1.754e+04
factor(BusinessTravel)Travel_Frequently:factor(WorkLifeBalance).L 1.948e+05
factor(BusinessTravel)Travel_Rarely:factor(WorkLifeBalance).L 1.925e+05
factor(BusinessTravel)Travel_Frequently:factor(WorkLifeBalance).Q 1.460e+05
factor(BusinessTravel)Travel_Rarely:factor(WorkLifeBalance).Q 1.444e+05
factor(BusinessTravel)Travel_Frequently:factor(WorkLifeBalance).C 6.856e+04
factor(BusinessTravel)Travel_Rarely:factor(WorkLifeBalance).C 6.783e+04
DistanceFromHome:factor(WorkLifeBalance).L 2.454e+04
DistanceFromHome:factor(WorkLifeBalance).Q 1.838e+04
DistanceFromHome:factor(WorkLifeBalance).C 8.566e+03
factor(MaritalStatus)Married:factor(WorkLifeBalance).L 1.966e+05
factor(MaritalStatus)Single:factor(WorkLifeBalance).L 2.065e+05
factor(MaritalStatus)Married:factor(WorkLifeBalance).Q 1.478e+05
factor(MaritalStatus)Single:factor(WorkLifeBalance).Q 3.959e+05
factor(MaritalStatus)Married:factor(WorkLifeBalance).C 7.078e+04
factor(MaritalStatus)Single:factor(WorkLifeBalance).C 5.823e+04
factor(Education).L:EducationFieldLife Sciences 8.739e+03
factor(Education).Q:EducationFieldLife Sciences 7.386e+03
factor(Education).C:EducationFieldLife Sciences 1.485e+04
factor(Education)^4:EducationFieldLife Sciences 1.112e+04
factor(Education).L:EducationFieldMarketing 7.332e+03
factor(Education).Q:EducationFieldMarketing 6.196e+03
factor(Education).C:EducationFieldMarketing 1.466e+04
factor(Education)^4:EducationFieldMarketing 1.108e+04
factor(Education).L:EducationFieldMedical 8.569e+03
factor(Education).Q:EducationFieldMedical 7.242e+03
factor(Education).C:EducationFieldMedical 1.483e+04
factor(Education)^4:EducationFieldMedical 1.112e+04
factor(Education).L:EducationFieldOther 2.277e+04
factor(Education).Q:EducationFieldOther 1.924e+04
factor(Education).C:EducationFieldOther 1.820e+04
factor(Education)^4:EducationFieldOther 1.181e+04
factor(Education).L:EducationFieldTechnical Degree 7.332e+03
factor(Education).Q:EducationFieldTechnical Degree 6.196e+03
factor(Education).C:EducationFieldTechnical Degree 1.466e+04
factor(Education)^4:EducationFieldTechnical Degree 1.108e+04
factor(JobInvolvement).L:factor(JobLevel)2 3.643e+03
factor(JobInvolvement).Q:factor(JobLevel)2 2.715e+03
factor(JobInvolvement).C:factor(JobLevel)2 1.214e+03
factor(JobInvolvement).L:factor(JobLevel)3 9.497e+03
factor(JobInvolvement).Q:factor(JobLevel)3 8.371e+03
factor(JobInvolvement).C:factor(JobLevel)3 2.691e+03
factor(JobInvolvement).L:factor(JobLevel)4 1.010e+05
factor(JobInvolvement).Q:factor(JobLevel)4 4.553e+04
factor(JobInvolvement).C:factor(JobLevel)4 3.383e+04
factor(JobInvolvement).L:factor(JobLevel)5 6.079e+04
factor(JobInvolvement).Q:factor(JobLevel)5 4.909e+04
factor(JobInvolvement).C:factor(JobLevel)5 2.648e+04
factor(JobInvolvement).L:factor(JobSatisfaction).L 5.258e+03
factor(JobInvolvement).Q:factor(JobSatisfaction).L 3.919e+03
factor(JobInvolvement).C:factor(JobSatisfaction).L 1.753e+03
factor(JobInvolvement).L:factor(JobSatisfaction).Q 5.386e+03
factor(JobInvolvement).Q:factor(JobSatisfaction).Q 4.015e+03
factor(JobInvolvement).C:factor(JobSatisfaction).Q 1.795e+03
factor(JobInvolvement).L:factor(JobSatisfaction).C 5.512e+03
factor(JobInvolvement).Q:factor(JobSatisfaction).C 4.109e+03
factor(JobInvolvement).C:factor(JobSatisfaction).C 1.837e+03
factor(JobLevel)2:factor(JobSatisfaction).L 2.567e+03
factor(JobLevel)3:factor(JobSatisfaction).L 6.777e+03
factor(JobLevel)4:factor(JobSatisfaction).L 7.208e+04
factor(JobLevel)5:factor(JobSatisfaction).L 7.234e+04
factor(JobLevel)2:factor(JobSatisfaction).Q 2.715e+03
factor(JobLevel)3:factor(JobSatisfaction).Q 8.262e+03
factor(JobLevel)4:factor(JobSatisfaction).Q 7.454e+04
factor(JobLevel)5:factor(JobSatisfaction).Q 6.577e+04
factor(JobLevel)2:factor(JobSatisfaction).C 2.856e+03
factor(JobLevel)3:factor(JobSatisfaction).C 1.106e+04
factor(JobLevel)4:factor(JobSatisfaction).C 4.768e+04
factor(JobLevel)5:factor(JobSatisfaction).C 1.756e+04
factor(EnvironmentSatisfaction).L:factor(Gender)Male 4.855e+03
factor(EnvironmentSatisfaction).Q:factor(Gender)Male 6.436e+03
factor(EnvironmentSatisfaction).C:factor(Gender)Male 7.699e+03
factor(EnvironmentSatisfaction).L:factor(JobRole)Human Resources 3.419e+03
factor(EnvironmentSatisfaction).Q:factor(JobRole)Human Resources 7.646e+03
factor(EnvironmentSatisfaction).C:factor(JobRole)Human Resources 1.026e+04
factor(EnvironmentSatisfaction).L:factor(JobRole)Laboratory Technician 2.252e+03
factor(EnvironmentSatisfaction).Q:factor(JobRole)Laboratory Technician 5.036e+03
factor(EnvironmentSatisfaction).C:factor(JobRole)Laboratory Technician 6.757e+03
factor(EnvironmentSatisfaction).L:factor(JobRole)Manager 6.279e+03
factor(EnvironmentSatisfaction).Q:factor(JobRole)Manager 8.845e+03
factor(EnvironmentSatisfaction).C:factor(JobRole)Manager 1.082e+04
factor(EnvironmentSatisfaction).L:factor(JobRole)Manufacturing Director 9.304e+03
factor(EnvironmentSatisfaction).Q:factor(JobRole)Manufacturing Director 8.405e+03
factor(EnvironmentSatisfaction).C:factor(JobRole)Manufacturing Director 7.397e+03
factor(EnvironmentSatisfaction).L:factor(JobRole)Research Director 8.667e+03
factor(EnvironmentSatisfaction).Q:factor(JobRole)Research Director 1.109e+04
factor(EnvironmentSatisfaction).C:factor(JobRole)Research Director 1.323e+04
factor(EnvironmentSatisfaction).L:factor(JobRole)Research Scientist 2.252e+03
factor(EnvironmentSatisfaction).Q:factor(JobRole)Research Scientist 5.036e+03
factor(EnvironmentSatisfaction).C:factor(JobRole)Research Scientist 6.757e+03
factor(EnvironmentSatisfaction).L:factor(JobRole)Sales Executive 2.252e+03
factor(EnvironmentSatisfaction).Q:factor(JobRole)Sales Executive 5.036e+03
factor(EnvironmentSatisfaction).C:factor(JobRole)Sales Executive 6.757e+03
factor(EnvironmentSatisfaction).L:factor(JobRole)Sales Representative 9.175e+03
factor(EnvironmentSatisfaction).Q:factor(JobRole)Sales Representative 8.325e+03
factor(EnvironmentSatisfaction).C:factor(JobRole)Sales Representative 7.379e+03
factor(Gender)Male:factor(JobRole)Human Resources 4.629e+03
factor(Gender)Male:factor(JobRole)Laboratory Technician 3.218e+03
factor(Gender)Male:factor(JobRole)Manager 5.084e+03
factor(Gender)Male:factor(JobRole)Manufacturing Director 4.656e+03
factor(Gender)Male:factor(JobRole)Research Director 8.916e+03
factor(Gender)Male:factor(JobRole)Research Scientist 3.218e+03
factor(Gender)Male:factor(JobRole)Sales Executive 3.218e+03
factor(Gender)Male:factor(JobRole)Sales Representative 4.620e+03
MonthlyIncome:HourlyRate 3.738e-06
MonthlyIncome:factor(OverTime)1 4.070e-04
HourlyRate:factor(OverTime)1 3.008e-02
factor(StockOptionLevel).L:TotalWorkingYears 3.003e-01
factor(StockOptionLevel).Q:TotalWorkingYears 3.000e-01
factor(StockOptionLevel).C:TotalWorkingYears 2.735e-01
factor(StockOptionLevel).L:TrainingTimesLastYear 1.076e+00
factor(StockOptionLevel).Q:TrainingTimesLastYear 9.678e-01
factor(StockOptionLevel).C:TrainingTimesLastYear 8.183e-01
TotalWorkingYears:TrainingTimesLastYear 4.802e-02
PercentSalaryHike:YearsAtCompany 2.637e-02
PercentSalaryHike:YearsSinceLastPromotion 8.424e-02
YearsAtCompany:YearsSinceLastPromotion 1.101e-01
PercentSalaryHike:YearsWithCurrManager 4.168e-02
YearsAtCompany:YearsWithCurrManager 6.229e-02
YearsSinceLastPromotion:YearsWithCurrManager 2.002e-01
factor(BusinessTravel)Travel_Frequently:DistanceFromHome:factor(MaritalStatus)Married 9.616e+03
factor(BusinessTravel)Travel_Rarely:DistanceFromHome:factor(MaritalStatus)Married 9.537e+03
factor(BusinessTravel)Travel_Frequently:DistanceFromHome:factor(MaritalStatus)Single 1.758e+04
factor(BusinessTravel)Travel_Rarely:DistanceFromHome:factor(MaritalStatus)Single 1.753e+04
factor(BusinessTravel)Travel_Frequently:DistanceFromHome:factor(WorkLifeBalance).L 2.470e+04
factor(BusinessTravel)Travel_Rarely:DistanceFromHome:factor(WorkLifeBalance).L 2.459e+04
factor(BusinessTravel)Travel_Frequently:DistanceFromHome:factor(WorkLifeBalance).Q 1.850e+04
factor(BusinessTravel)Travel_Rarely:DistanceFromHome:factor(WorkLifeBalance).Q 1.842e+04
factor(BusinessTravel)Travel_Frequently:DistanceFromHome:factor(WorkLifeBalance).C 8.619e+03
factor(BusinessTravel)Travel_Rarely:DistanceFromHome:factor(WorkLifeBalance).C 8.584e+03
factor(BusinessTravel)Travel_Frequently:factor(MaritalStatus)Married:factor(WorkLifeBalance).L 2.001e+05
factor(BusinessTravel)Travel_Rarely:factor(MaritalStatus)Married:factor(WorkLifeBalance).L 1.975e+05
z value
(Intercept) 0.000
Age -4.010
factor(BusinessTravel)Travel_Frequently -0.001
factor(BusinessTravel)Travel_Rarely -0.001
DistanceFromHome -0.001
factor(MaritalStatus)Married -0.002
factor(MaritalStatus)Single -0.002
factor(WorkLifeBalance).L 0.000
factor(WorkLifeBalance).Q 0.001
factor(WorkLifeBalance).C 0.000
DailyRate -2.975
factor(Department)Research & Development 0.003
factor(Department)Sales -0.003
factor(Education).L 0.002
factor(Education).Q 0.001
factor(Education).C -0.003
factor(Education)^4 0.000
EducationFieldLife Sciences -0.002
EducationFieldMarketing -0.001
EducationFieldMedical -0.002
EducationFieldOther -0.001
EducationFieldTechnical Degree 0.000
factor(JobInvolvement).L -0.005
factor(JobInvolvement).Q 0.001
factor(JobInvolvement).C -0.006
factor(JobLevel)2 -0.004
factor(JobLevel)3 -0.003
factor(JobLevel)4 0.001
factor(JobLevel)5 0.002
factor(JobSatisfaction).L -0.005
factor(JobSatisfaction).Q -0.001
factor(JobSatisfaction).C 0.000
factor(EnvironmentSatisfaction).L 0.001
factor(EnvironmentSatisfaction).Q 0.005
factor(EnvironmentSatisfaction).C -0.003
factor(Gender)Male -0.002
factor(JobRole)Human Resources 0.004
factor(JobRole)Laboratory Technician 0.004
factor(JobRole)Manager -0.008
factor(JobRole)Manufacturing Director -0.003
factor(JobRole)Research Director -0.004
factor(JobRole)Research Scientist 0.003
factor(JobRole)Sales Executive 0.015
factor(JobRole)Sales Representative 0.014
MonthlyIncome -2.153
HourlyRate -0.738
factor(OverTime)1 -0.140
NumCompaniesWorked 6.778
factor(PerformanceRating).L -1.632
factor(RelationshipSatisfaction).L -7.755
factor(RelationshipSatisfaction).Q 2.875
factor(RelationshipSatisfaction).C -1.471
factor(StockOptionLevel).L 0.235
factor(StockOptionLevel).Q 0.252
factor(StockOptionLevel).C -1.759
TotalWorkingYears -2.284
TrainingTimesLastYear -2.715
PercentSalaryHike 1.854
YearsAtCompany 1.561
YearsSinceLastPromotion -0.482
YearsWithCurrManager -3.642
factor(BusinessTravel)Travel_Frequently:DistanceFromHome 0.001
factor(BusinessTravel)Travel_Rarely:DistanceFromHome 0.001
factor(BusinessTravel)Travel_Frequently:factor(MaritalStatus)Married 0.002
factor(BusinessTravel)Travel_Rarely:factor(MaritalStatus)Married 0.002
factor(BusinessTravel)Travel_Frequently:factor(MaritalStatus)Single 0.002
factor(BusinessTravel)Travel_Rarely:factor(MaritalStatus)Single 0.002
DistanceFromHome:factor(MaritalStatus)Married 0.001
DistanceFromHome:factor(MaritalStatus)Single 0.002
factor(BusinessTravel)Travel_Frequently:factor(WorkLifeBalance).L 0.000
factor(BusinessTravel)Travel_Rarely:factor(WorkLifeBalance).L 0.000
factor(BusinessTravel)Travel_Frequently:factor(WorkLifeBalance).Q -0.001
factor(BusinessTravel)Travel_Rarely:factor(WorkLifeBalance).Q -0.001
factor(BusinessTravel)Travel_Frequently:factor(WorkLifeBalance).C 0.000
factor(BusinessTravel)Travel_Rarely:factor(WorkLifeBalance).C 0.000
DistanceFromHome:factor(WorkLifeBalance).L 0.000
DistanceFromHome:factor(WorkLifeBalance).Q -0.001
DistanceFromHome:factor(WorkLifeBalance).C 0.000
factor(MaritalStatus)Married:factor(WorkLifeBalance).L 0.000
factor(MaritalStatus)Single:factor(WorkLifeBalance).L 0.004
factor(MaritalStatus)Married:factor(WorkLifeBalance).Q 0.000
factor(MaritalStatus)Single:factor(WorkLifeBalance).Q -0.001
factor(MaritalStatus)Married:factor(WorkLifeBalance).C -0.003
factor(MaritalStatus)Single:factor(WorkLifeBalance).C 0.001
factor(Education).L:EducationFieldLife Sciences -0.003
factor(Education).Q:EducationFieldLife Sciences -0.002
factor(Education).C:EducationFieldLife Sciences 0.002
factor(Education)^4:EducationFieldLife Sciences -0.001
factor(Education).L:EducationFieldMarketing -0.002
factor(Education).Q:EducationFieldMarketing -0.001
factor(Education).C:EducationFieldMarketing 0.003
factor(Education)^4:EducationFieldMarketing 0.000
factor(Education).L:EducationFieldMedical -0.003
factor(Education).Q:EducationFieldMedical -0.002
factor(Education).C:EducationFieldMedical 0.002
factor(Education)^4:EducationFieldMedical -0.001
factor(Education).L:EducationFieldOther -0.001
factor(Education).Q:EducationFieldOther -0.001
factor(Education).C:EducationFieldOther 0.002
factor(Education)^4:EducationFieldOther -0.001
factor(Education).L:EducationFieldTechnical Degree -0.001
factor(Education).Q:EducationFieldTechnical Degree 0.000
factor(Education).C:EducationFieldTechnical Degree 0.003
factor(Education)^4:EducationFieldTechnical Degree 0.000
factor(JobInvolvement).L:factor(JobLevel)2 0.001
factor(JobInvolvement).Q:factor(JobLevel)2 -0.003
factor(JobInvolvement).C:factor(JobLevel)2 0.001
factor(JobInvolvement).L:factor(JobLevel)3 0.003
factor(JobInvolvement).Q:factor(JobLevel)3 -0.003
factor(JobInvolvement).C:factor(JobLevel)3 0.003
factor(JobInvolvement).L:factor(JobLevel)4 -0.001
factor(JobInvolvement).Q:factor(JobLevel)4 0.002
factor(JobInvolvement).C:factor(JobLevel)4 -0.001
factor(JobInvolvement).L:factor(JobLevel)5 -0.001
factor(JobInvolvement).Q:factor(JobLevel)5 0.001
factor(JobInvolvement).C:factor(JobLevel)5 0.000
factor(JobInvolvement).L:factor(JobSatisfaction).L 0.001
factor(JobInvolvement).Q:factor(JobSatisfaction).L -0.004
factor(JobInvolvement).C:factor(JobSatisfaction).L 0.002
factor(JobInvolvement).L:factor(JobSatisfaction).Q -0.002
factor(JobInvolvement).Q:factor(JobSatisfaction).Q -0.001
factor(JobInvolvement).C:factor(JobSatisfaction).Q -0.001
factor(JobInvolvement).L:factor(JobSatisfaction).C -0.001
factor(JobInvolvement).Q:factor(JobSatisfaction).C 0.001
factor(JobInvolvement).C:factor(JobSatisfaction).C -0.001
factor(JobLevel)2:factor(JobSatisfaction).L 0.003
factor(JobLevel)3:factor(JobSatisfaction).L 0.004
factor(JobLevel)4:factor(JobSatisfaction).L 0.000
factor(JobLevel)5:factor(JobSatisfaction).L -0.001
factor(JobLevel)2:factor(JobSatisfaction).Q -0.001
factor(JobLevel)3:factor(JobSatisfaction).Q 0.002
factor(JobLevel)4:factor(JobSatisfaction).Q 0.001
factor(JobLevel)5:factor(JobSatisfaction).Q 0.000
factor(JobLevel)2:factor(JobSatisfaction).C -0.002
factor(JobLevel)3:factor(JobSatisfaction).C 0.001
factor(JobLevel)4:factor(JobSatisfaction).C 0.000
factor(JobLevel)5:factor(JobSatisfaction).C 0.002
factor(EnvironmentSatisfaction).L:factor(Gender)Male -0.005
factor(EnvironmentSatisfaction).Q:factor(Gender)Male -0.003
factor(EnvironmentSatisfaction).C:factor(Gender)Male 0.004
factor(EnvironmentSatisfaction).L:factor(JobRole)Human Resources -0.003
factor(EnvironmentSatisfaction).Q:factor(JobRole)Human Resources -0.003
factor(EnvironmentSatisfaction).C:factor(JobRole)Human Resources 0.003
factor(EnvironmentSatisfaction).L:factor(JobRole)Laboratory Technician -0.003
factor(EnvironmentSatisfaction).Q:factor(JobRole)Laboratory Technician -0.005
factor(EnvironmentSatisfaction).C:factor(JobRole)Laboratory Technician 0.003
factor(EnvironmentSatisfaction).L:factor(JobRole)Manager 0.002
factor(EnvironmentSatisfaction).Q:factor(JobRole)Manager -0.003
factor(EnvironmentSatisfaction).C:factor(JobRole)Manager 0.002
factor(EnvironmentSatisfaction).L:factor(JobRole)Manufacturing Director -0.002
factor(EnvironmentSatisfaction).Q:factor(JobRole)Manufacturing Director -0.008
factor(EnvironmentSatisfaction).C:factor(JobRole)Manufacturing Director 0.002
factor(EnvironmentSatisfaction).L:factor(JobRole)Research Director -0.003
factor(EnvironmentSatisfaction).Q:factor(JobRole)Research Director -0.004
factor(EnvironmentSatisfaction).C:factor(JobRole)Research Director 0.008
factor(EnvironmentSatisfaction).L:factor(JobRole)Research Scientist -0.002
factor(EnvironmentSatisfaction).Q:factor(JobRole)Research Scientist -0.004
factor(EnvironmentSatisfaction).C:factor(JobRole)Research Scientist 0.002
factor(EnvironmentSatisfaction).L:factor(JobRole)Sales Executive -0.002
factor(EnvironmentSatisfaction).Q:factor(JobRole)Sales Executive -0.004
factor(EnvironmentSatisfaction).C:factor(JobRole)Sales Executive 0.003
factor(EnvironmentSatisfaction).L:factor(JobRole)Sales Representative -0.002
factor(EnvironmentSatisfaction).Q:factor(JobRole)Sales Representative -0.002
factor(EnvironmentSatisfaction).C:factor(JobRole)Sales Representative 0.002
factor(Gender)Male:factor(JobRole)Human Resources -0.001
factor(Gender)Male:factor(JobRole)Laboratory Technician 0.002
factor(Gender)Male:factor(JobRole)Manager 0.008
factor(Gender)Male:factor(JobRole)Manufacturing Director 0.006
factor(Gender)Male:factor(JobRole)Research Director -0.005
factor(Gender)Male:factor(JobRole)Research Scientist 0.002
factor(Gender)Male:factor(JobRole)Sales Executive 0.002
factor(Gender)Male:factor(JobRole)Sales Representative 0.001
MonthlyIncome:HourlyRate 3.358
MonthlyIncome:factor(OverTime)1 3.653
HourlyRate:factor(OverTime)1 3.886
factor(StockOptionLevel).L:TotalWorkingYears 1.140
factor(StockOptionLevel).Q:TotalWorkingYears 2.906
factor(StockOptionLevel).C:TotalWorkingYears 2.662
factor(StockOptionLevel).L:TrainingTimesLastYear -1.392
factor(StockOptionLevel).Q:TrainingTimesLastYear 0.863
factor(StockOptionLevel).C:TrainingTimesLastYear 1.735
TotalWorkingYears:TrainingTimesLastYear 0.599
PercentSalaryHike:YearsAtCompany -1.093
PercentSalaryHike:YearsSinceLastPromotion -0.473
YearsAtCompany:YearsSinceLastPromotion 0.702
PercentSalaryHike:YearsWithCurrManager 2.436
YearsAtCompany:YearsWithCurrManager 1.036
YearsSinceLastPromotion:YearsWithCurrManager 1.871
factor(BusinessTravel)Travel_Frequently:DistanceFromHome:factor(MaritalStatus)Married -0.001
factor(BusinessTravel)Travel_Rarely:DistanceFromHome:factor(MaritalStatus)Married -0.001
factor(BusinessTravel)Travel_Frequently:DistanceFromHome:factor(MaritalStatus)Single -0.002
factor(BusinessTravel)Travel_Rarely:DistanceFromHome:factor(MaritalStatus)Single -0.002
factor(BusinessTravel)Travel_Frequently:DistanceFromHome:factor(WorkLifeBalance).L 0.000
factor(BusinessTravel)Travel_Rarely:DistanceFromHome:factor(WorkLifeBalance).L 0.000
factor(BusinessTravel)Travel_Frequently:DistanceFromHome:factor(WorkLifeBalance).Q 0.001
factor(BusinessTravel)Travel_Rarely:DistanceFromHome:factor(WorkLifeBalance).Q 0.001
factor(BusinessTravel)Travel_Frequently:DistanceFromHome:factor(WorkLifeBalance).C 0.000
factor(BusinessTravel)Travel_Rarely:DistanceFromHome:factor(WorkLifeBalance).C 0.000
factor(BusinessTravel)Travel_Frequently:factor(MaritalStatus)Married:factor(WorkLifeBalance).L 0.000
factor(BusinessTravel)Travel_Rarely:factor(MaritalStatus)Married:factor(WorkLifeBalance).L -0.001
Pr(>|z|)
(Intercept) 0.999983
Age 6.07e-05
factor(BusinessTravel)Travel_Frequently 0.999543
factor(BusinessTravel)Travel_Rarely 0.999455
DistanceFromHome 0.999483
factor(MaritalStatus)Married 0.998533
factor(MaritalStatus)Single 0.998421
factor(WorkLifeBalance).L 0.999914
factor(WorkLifeBalance).Q 0.999372
factor(WorkLifeBalance).C 0.999946
DailyRate 0.002929
factor(Department)Research & Development 0.997515
factor(Department)Sales 0.997827
factor(Education).L 0.998689
factor(Education).Q 0.999594
factor(Education).C 0.998001
factor(Education)^4 0.999626
EducationFieldLife Sciences 0.998567
EducationFieldMarketing 0.999486
EducationFieldMedical 0.998743
EducationFieldOther 0.999149
EducationFieldTechnical Degree 0.999667
factor(JobInvolvement).L 0.995623
factor(JobInvolvement).Q 0.999182
factor(JobInvolvement).C 0.995333
factor(JobLevel)2 0.996568
factor(JobLevel)3 0.997826
factor(JobLevel)4 0.998936
factor(JobLevel)5 0.998376
factor(JobSatisfaction).L 0.995922
factor(JobSatisfaction).Q 0.999461
factor(JobSatisfaction).C 0.999912
factor(EnvironmentSatisfaction).L 0.999043
factor(EnvironmentSatisfaction).Q 0.996274
factor(EnvironmentSatisfaction).C 0.997872
factor(Gender)Male 0.998513
factor(JobRole)Human Resources 0.996774
factor(JobRole)Laboratory Technician 0.997094
factor(JobRole)Manager 0.993528
factor(JobRole)Manufacturing Director 0.997459
factor(JobRole)Research Director 0.997137
factor(JobRole)Research Scientist 0.997889
factor(JobRole)Sales Executive 0.987898
factor(JobRole)Sales Representative 0.989208
MonthlyIncome 0.031297
HourlyRate 0.460351
factor(OverTime)1 0.888732
NumCompaniesWorked 1.21e-11
factor(PerformanceRating).L 0.102673
factor(RelationshipSatisfaction).L 8.86e-15
factor(RelationshipSatisfaction).Q 0.004042
factor(RelationshipSatisfaction).C 0.141275
factor(StockOptionLevel).L 0.814290
factor(StockOptionLevel).Q 0.801319
factor(StockOptionLevel).C 0.078572
TotalWorkingYears 0.022367
TrainingTimesLastYear 0.006627
PercentSalaryHike 0.063778
YearsAtCompany 0.118556
YearsSinceLastPromotion 0.630040
YearsWithCurrManager 0.000271
factor(BusinessTravel)Travel_Frequently:DistanceFromHome 0.999441
factor(BusinessTravel)Travel_Rarely:DistanceFromHome 0.999351
factor(BusinessTravel)Travel_Frequently:factor(MaritalStatus)Married 0.998361
factor(BusinessTravel)Travel_Rarely:factor(MaritalStatus)Married 0.998365
factor(BusinessTravel)Travel_Frequently:factor(MaritalStatus)Single 0.998379
factor(BusinessTravel)Travel_Rarely:factor(MaritalStatus)Single 0.998348
DistanceFromHome:factor(MaritalStatus)Married 0.999075
DistanceFromHome:factor(MaritalStatus)Single 0.998330
factor(BusinessTravel)Travel_Frequently:factor(WorkLifeBalance).L 0.999885
factor(BusinessTravel)Travel_Rarely:factor(WorkLifeBalance).L 0.999889
factor(BusinessTravel)Travel_Frequently:factor(WorkLifeBalance).Q 0.999246
factor(BusinessTravel)Travel_Rarely:factor(WorkLifeBalance).Q 0.999244
factor(BusinessTravel)Travel_Frequently:factor(WorkLifeBalance).C 0.999976
factor(BusinessTravel)Travel_Rarely:factor(WorkLifeBalance).C 0.999887
DistanceFromHome:factor(WorkLifeBalance).L 0.999925
DistanceFromHome:factor(WorkLifeBalance).Q 0.999500
DistanceFromHome:factor(WorkLifeBalance).C 0.999998
factor(MaritalStatus)Married:factor(WorkLifeBalance).L 0.999728
factor(MaritalStatus)Single:factor(WorkLifeBalance).L 0.997162
factor(MaritalStatus)Married:factor(WorkLifeBalance).Q 0.999795
factor(MaritalStatus)Single:factor(WorkLifeBalance).Q 0.998941
factor(MaritalStatus)Married:factor(WorkLifeBalance).C 0.997297
factor(MaritalStatus)Single:factor(WorkLifeBalance).C 0.999511
factor(Education).L:EducationFieldLife Sciences 0.997955
factor(Education).Q:EducationFieldLife Sciences 0.998348
factor(Education).C:EducationFieldLife Sciences 0.998306
factor(Education)^4:EducationFieldLife Sciences 0.999419
factor(Education).L:EducationFieldMarketing 0.998513
factor(Education).Q:EducationFieldMarketing 0.999513
factor(Education).C:EducationFieldMarketing 0.997955
factor(Education)^4:EducationFieldMarketing 0.999644
factor(Education).L:EducationFieldMedical 0.997633
factor(Education).Q:EducationFieldMedical 0.998431
factor(Education).C:EducationFieldMedical 0.998290
factor(Education)^4:EducationFieldMedical 0.999347
factor(Education).L:EducationFieldOther 0.999300
factor(Education).Q:EducationFieldOther 0.999475
factor(Education).C:EducationFieldOther 0.998731
factor(Education)^4:EducationFieldOther 0.999514
factor(Education).L:EducationFieldTechnical Degree 0.999363
factor(Education).Q:EducationFieldTechnical Degree 0.999874
factor(Education).C:EducationFieldTechnical Degree 0.997871
factor(Education)^4:EducationFieldTechnical Degree 0.999899
factor(JobInvolvement).L:factor(JobLevel)2 0.999583
factor(JobInvolvement).Q:factor(JobLevel)2 0.997580
factor(JobInvolvement).C:factor(JobLevel)2 0.999372
factor(JobInvolvement).L:factor(JobLevel)3 0.997211
factor(JobInvolvement).Q:factor(JobLevel)3 0.997805
factor(JobInvolvement).C:factor(JobLevel)3 0.997708
factor(JobInvolvement).L:factor(JobLevel)4 0.999035
factor(JobInvolvement).Q:factor(JobLevel)4 0.998522
factor(JobInvolvement).C:factor(JobLevel)4 0.998825
factor(JobInvolvement).L:factor(JobLevel)5 0.999411
factor(JobInvolvement).Q:factor(JobLevel)5 0.999229
factor(JobInvolvement).C:factor(JobLevel)5 0.999723
factor(JobInvolvement).L:factor(JobSatisfaction).L 0.999557
factor(JobInvolvement).Q:factor(JobSatisfaction).L 0.996497
factor(JobInvolvement).C:factor(JobSatisfaction).L 0.998010
factor(JobInvolvement).L:factor(JobSatisfaction).Q 0.998419
factor(JobInvolvement).Q:factor(JobSatisfaction).Q 0.999177
factor(JobInvolvement).C:factor(JobSatisfaction).Q 0.998836
factor(JobInvolvement).L:factor(JobSatisfaction).C 0.998808
factor(JobInvolvement).Q:factor(JobSatisfaction).C 0.999327
factor(JobInvolvement).C:factor(JobSatisfaction).C 0.999112
factor(JobLevel)2:factor(JobSatisfaction).L 0.997473
factor(JobLevel)3:factor(JobSatisfaction).L 0.997148
factor(JobLevel)4:factor(JobSatisfaction).L 0.999822
factor(JobLevel)5:factor(JobSatisfaction).L 0.999338
factor(JobLevel)2:factor(JobSatisfaction).Q 0.998884
factor(JobLevel)3:factor(JobSatisfaction).Q 0.998559
factor(JobLevel)4:factor(JobSatisfaction).Q 0.999282
factor(JobLevel)5:factor(JobSatisfaction).Q 0.999725
factor(JobLevel)2:factor(JobSatisfaction).C 0.998792
factor(JobLevel)3:factor(JobSatisfaction).C 0.999568
factor(JobLevel)4:factor(JobSatisfaction).C 0.999644
factor(JobLevel)5:factor(JobSatisfaction).C 0.998333
factor(EnvironmentSatisfaction).L:factor(Gender)Male 0.996129
factor(EnvironmentSatisfaction).Q:factor(Gender)Male 0.997405
factor(EnvironmentSatisfaction).C:factor(Gender)Male 0.996473
factor(EnvironmentSatisfaction).L:factor(JobRole)Human Resources 0.997436
factor(EnvironmentSatisfaction).Q:factor(JobRole)Human Resources 0.997239
factor(EnvironmentSatisfaction).C:factor(JobRole)Human Resources 0.997686
factor(EnvironmentSatisfaction).L:factor(JobRole)Laboratory Technician 0.997922
factor(EnvironmentSatisfaction).Q:factor(JobRole)Laboratory Technician 0.996063
factor(EnvironmentSatisfaction).C:factor(JobRole)Laboratory Technician 0.997776
factor(EnvironmentSatisfaction).L:factor(JobRole)Manager 0.998372
factor(EnvironmentSatisfaction).Q:factor(JobRole)Manager 0.997575
factor(EnvironmentSatisfaction).C:factor(JobRole)Manager 0.998376
factor(EnvironmentSatisfaction).L:factor(JobRole)Manufacturing Director 0.998726
factor(EnvironmentSatisfaction).Q:factor(JobRole)Manufacturing Director 0.993965
factor(EnvironmentSatisfaction).C:factor(JobRole)Manufacturing Director 0.998178
factor(EnvironmentSatisfaction).L:factor(JobRole)Research Director 0.997314
factor(EnvironmentSatisfaction).Q:factor(JobRole)Research Director 0.997121
factor(EnvironmentSatisfaction).C:factor(JobRole)Research Director 0.993921
factor(EnvironmentSatisfaction).L:factor(JobRole)Research Scientist 0.998086
factor(EnvironmentSatisfaction).Q:factor(JobRole)Research Scientist 0.996998
factor(EnvironmentSatisfaction).C:factor(JobRole)Research Scientist 0.998390
factor(EnvironmentSatisfaction).L:factor(JobRole)Sales Executive 0.998393
factor(EnvironmentSatisfaction).Q:factor(JobRole)Sales Executive 0.996684
factor(EnvironmentSatisfaction).C:factor(JobRole)Sales Executive 0.997785
factor(EnvironmentSatisfaction).L:factor(JobRole)Sales Representative 0.998285
factor(EnvironmentSatisfaction).Q:factor(JobRole)Sales Representative 0.998599
factor(EnvironmentSatisfaction).C:factor(JobRole)Sales Representative 0.998566
factor(Gender)Male:factor(JobRole)Human Resources 0.999241
factor(Gender)Male:factor(JobRole)Laboratory Technician 0.998012
factor(Gender)Male:factor(JobRole)Manager 0.993826
factor(Gender)Male:factor(JobRole)Manufacturing Director 0.995179
factor(Gender)Male:factor(JobRole)Research Director 0.996409
factor(Gender)Male:factor(JobRole)Research Scientist 0.998039
factor(Gender)Male:factor(JobRole)Sales Executive 0.998021
factor(Gender)Male:factor(JobRole)Sales Representative 0.999583
MonthlyIncome:HourlyRate 0.000785
MonthlyIncome:factor(OverTime)1 0.000259
HourlyRate:factor(OverTime)1 0.000102
factor(StockOptionLevel).L:TotalWorkingYears 0.254398
factor(StockOptionLevel).Q:TotalWorkingYears 0.003660
factor(StockOptionLevel).C:TotalWorkingYears 0.007764
factor(StockOptionLevel).L:TrainingTimesLastYear 0.163922
factor(StockOptionLevel).Q:TrainingTimesLastYear 0.387976
factor(StockOptionLevel).C:TrainingTimesLastYear 0.082746
TotalWorkingYears:TrainingTimesLastYear 0.549277
PercentSalaryHike:YearsAtCompany 0.274252
PercentSalaryHike:YearsSinceLastPromotion 0.635982
YearsAtCompany:YearsSinceLastPromotion 0.482535
PercentSalaryHike:YearsWithCurrManager 0.014842
YearsAtCompany:YearsWithCurrManager 0.300096
YearsSinceLastPromotion:YearsWithCurrManager 0.061365
factor(BusinessTravel)Travel_Frequently:DistanceFromHome:factor(MaritalStatus)Married 0.998897
factor(BusinessTravel)Travel_Rarely:DistanceFromHome:factor(MaritalStatus)Married 0.998954
factor(BusinessTravel)Travel_Frequently:DistanceFromHome:factor(MaritalStatus)Single 0.998329
factor(BusinessTravel)Travel_Rarely:DistanceFromHome:factor(MaritalStatus)Single 0.998262
factor(BusinessTravel)Travel_Frequently:DistanceFromHome:factor(WorkLifeBalance).L 0.999950
factor(BusinessTravel)Travel_Rarely:DistanceFromHome:factor(WorkLifeBalance).L 0.999917
factor(BusinessTravel)Travel_Frequently:DistanceFromHome:factor(WorkLifeBalance).Q 0.999452
factor(BusinessTravel)Travel_Rarely:DistanceFromHome:factor(WorkLifeBalance).Q 0.999381
factor(BusinessTravel)Travel_Frequently:DistanceFromHome:factor(WorkLifeBalance).C 0.999958
factor(BusinessTravel)Travel_Rarely:DistanceFromHome:factor(WorkLifeBalance).C 0.999872
factor(BusinessTravel)Travel_Frequently:factor(MaritalStatus)Married:factor(WorkLifeBalance).L 0.999656
factor(BusinessTravel)Travel_Rarely:factor(MaritalStatus)Married:factor(WorkLifeBalance).L 0.999539
(Intercept)
Age ***
factor(BusinessTravel)Travel_Frequently
factor(BusinessTravel)Travel_Rarely
DistanceFromHome
factor(MaritalStatus)Married
factor(MaritalStatus)Single
factor(WorkLifeBalance).L
factor(WorkLifeBalance).Q
factor(WorkLifeBalance).C
DailyRate **
factor(Department)Research & Development
factor(Department)Sales
factor(Education).L
factor(Education).Q
factor(Education).C
factor(Education)^4
EducationFieldLife Sciences
EducationFieldMarketing
EducationFieldMedical
EducationFieldOther
EducationFieldTechnical Degree
factor(JobInvolvement).L
factor(JobInvolvement).Q
factor(JobInvolvement).C
factor(JobLevel)2
factor(JobLevel)3
factor(JobLevel)4
factor(JobLevel)5
factor(JobSatisfaction).L
factor(JobSatisfaction).Q
factor(JobSatisfaction).C
factor(EnvironmentSatisfaction).L
factor(EnvironmentSatisfaction).Q
factor(EnvironmentSatisfaction).C
factor(Gender)Male
factor(JobRole)Human Resources
factor(JobRole)Laboratory Technician
factor(JobRole)Manager
factor(JobRole)Manufacturing Director
factor(JobRole)Research Director
factor(JobRole)Research Scientist
factor(JobRole)Sales Executive
factor(JobRole)Sales Representative
MonthlyIncome *
HourlyRate
factor(OverTime)1
NumCompaniesWorked ***
factor(PerformanceRating).L
factor(RelationshipSatisfaction).L ***
factor(RelationshipSatisfaction).Q **
factor(RelationshipSatisfaction).C
factor(StockOptionLevel).L
factor(StockOptionLevel).Q
factor(StockOptionLevel).C .
TotalWorkingYears *
TrainingTimesLastYear **
PercentSalaryHike .
YearsAtCompany
YearsSinceLastPromotion
YearsWithCurrManager ***
factor(BusinessTravel)Travel_Frequently:DistanceFromHome
factor(BusinessTravel)Travel_Rarely:DistanceFromHome
factor(BusinessTravel)Travel_Frequently:factor(MaritalStatus)Married
factor(BusinessTravel)Travel_Rarely:factor(MaritalStatus)Married
factor(BusinessTravel)Travel_Frequently:factor(MaritalStatus)Single
factor(BusinessTravel)Travel_Rarely:factor(MaritalStatus)Single
DistanceFromHome:factor(MaritalStatus)Married
DistanceFromHome:factor(MaritalStatus)Single
factor(BusinessTravel)Travel_Frequently:factor(WorkLifeBalance).L
factor(BusinessTravel)Travel_Rarely:factor(WorkLifeBalance).L
factor(BusinessTravel)Travel_Frequently:factor(WorkLifeBalance).Q
factor(BusinessTravel)Travel_Rarely:factor(WorkLifeBalance).Q
factor(BusinessTravel)Travel_Frequently:factor(WorkLifeBalance).C
factor(BusinessTravel)Travel_Rarely:factor(WorkLifeBalance).C
DistanceFromHome:factor(WorkLifeBalance).L
DistanceFromHome:factor(WorkLifeBalance).Q
DistanceFromHome:factor(WorkLifeBalance).C
factor(MaritalStatus)Married:factor(WorkLifeBalance).L
factor(MaritalStatus)Single:factor(WorkLifeBalance).L
factor(MaritalStatus)Married:factor(WorkLifeBalance).Q
factor(MaritalStatus)Single:factor(WorkLifeBalance).Q
factor(MaritalStatus)Married:factor(WorkLifeBalance).C
factor(MaritalStatus)Single:factor(WorkLifeBalance).C
factor(Education).L:EducationFieldLife Sciences
factor(Education).Q:EducationFieldLife Sciences
factor(Education).C:EducationFieldLife Sciences
factor(Education)^4:EducationFieldLife Sciences
factor(Education).L:EducationFieldMarketing
factor(Education).Q:EducationFieldMarketing
factor(Education).C:EducationFieldMarketing
factor(Education)^4:EducationFieldMarketing
factor(Education).L:EducationFieldMedical
factor(Education).Q:EducationFieldMedical
factor(Education).C:EducationFieldMedical
factor(Education)^4:EducationFieldMedical
factor(Education).L:EducationFieldOther
factor(Education).Q:EducationFieldOther
factor(Education).C:EducationFieldOther
factor(Education)^4:EducationFieldOther
factor(Education).L:EducationFieldTechnical Degree
factor(Education).Q:EducationFieldTechnical Degree
factor(Education).C:EducationFieldTechnical Degree
factor(Education)^4:EducationFieldTechnical Degree
factor(JobInvolvement).L:factor(JobLevel)2
factor(JobInvolvement).Q:factor(JobLevel)2
factor(JobInvolvement).C:factor(JobLevel)2
factor(JobInvolvement).L:factor(JobLevel)3
factor(JobInvolvement).Q:factor(JobLevel)3
factor(JobInvolvement).C:factor(JobLevel)3
factor(JobInvolvement).L:factor(JobLevel)4
factor(JobInvolvement).Q:factor(JobLevel)4
factor(JobInvolvement).C:factor(JobLevel)4
factor(JobInvolvement).L:factor(JobLevel)5
factor(JobInvolvement).Q:factor(JobLevel)5
factor(JobInvolvement).C:factor(JobLevel)5
factor(JobInvolvement).L:factor(JobSatisfaction).L
factor(JobInvolvement).Q:factor(JobSatisfaction).L
factor(JobInvolvement).C:factor(JobSatisfaction).L
factor(JobInvolvement).L:factor(JobSatisfaction).Q
factor(JobInvolvement).Q:factor(JobSatisfaction).Q
factor(JobInvolvement).C:factor(JobSatisfaction).Q
factor(JobInvolvement).L:factor(JobSatisfaction).C
factor(JobInvolvement).Q:factor(JobSatisfaction).C
factor(JobInvolvement).C:factor(JobSatisfaction).C
factor(JobLevel)2:factor(JobSatisfaction).L
factor(JobLevel)3:factor(JobSatisfaction).L
factor(JobLevel)4:factor(JobSatisfaction).L
factor(JobLevel)5:factor(JobSatisfaction).L
factor(JobLevel)2:factor(JobSatisfaction).Q
factor(JobLevel)3:factor(JobSatisfaction).Q
factor(JobLevel)4:factor(JobSatisfaction).Q
factor(JobLevel)5:factor(JobSatisfaction).Q
factor(JobLevel)2:factor(JobSatisfaction).C
factor(JobLevel)3:factor(JobSatisfaction).C
factor(JobLevel)4:factor(JobSatisfaction).C
factor(JobLevel)5:factor(JobSatisfaction).C
factor(EnvironmentSatisfaction).L:factor(Gender)Male
factor(EnvironmentSatisfaction).Q:factor(Gender)Male
factor(EnvironmentSatisfaction).C:factor(Gender)Male
factor(EnvironmentSatisfaction).L:factor(JobRole)Human Resources
factor(EnvironmentSatisfaction).Q:factor(JobRole)Human Resources
factor(EnvironmentSatisfaction).C:factor(JobRole)Human Resources
factor(EnvironmentSatisfaction).L:factor(JobRole)Laboratory Technician
factor(EnvironmentSatisfaction).Q:factor(JobRole)Laboratory Technician
factor(EnvironmentSatisfaction).C:factor(JobRole)Laboratory Technician
factor(EnvironmentSatisfaction).L:factor(JobRole)Manager
factor(EnvironmentSatisfaction).Q:factor(JobRole)Manager
factor(EnvironmentSatisfaction).C:factor(JobRole)Manager
factor(EnvironmentSatisfaction).L:factor(JobRole)Manufacturing Director
factor(EnvironmentSatisfaction).Q:factor(JobRole)Manufacturing Director
factor(EnvironmentSatisfaction).C:factor(JobRole)Manufacturing Director
factor(EnvironmentSatisfaction).L:factor(JobRole)Research Director
factor(EnvironmentSatisfaction).Q:factor(JobRole)Research Director
factor(EnvironmentSatisfaction).C:factor(JobRole)Research Director
factor(EnvironmentSatisfaction).L:factor(JobRole)Research Scientist
factor(EnvironmentSatisfaction).Q:factor(JobRole)Research Scientist
factor(EnvironmentSatisfaction).C:factor(JobRole)Research Scientist
factor(EnvironmentSatisfaction).L:factor(JobRole)Sales Executive
factor(EnvironmentSatisfaction).Q:factor(JobRole)Sales Executive
factor(EnvironmentSatisfaction).C:factor(JobRole)Sales Executive
factor(EnvironmentSatisfaction).L:factor(JobRole)Sales Representative
factor(EnvironmentSatisfaction).Q:factor(JobRole)Sales Representative
factor(EnvironmentSatisfaction).C:factor(JobRole)Sales Representative
factor(Gender)Male:factor(JobRole)Human Resources
factor(Gender)Male:factor(JobRole)Laboratory Technician
factor(Gender)Male:factor(JobRole)Manager
factor(Gender)Male:factor(JobRole)Manufacturing Director
factor(Gender)Male:factor(JobRole)Research Director
factor(Gender)Male:factor(JobRole)Research Scientist
factor(Gender)Male:factor(JobRole)Sales Executive
factor(Gender)Male:factor(JobRole)Sales Representative
MonthlyIncome:HourlyRate ***
MonthlyIncome:factor(OverTime)1 ***
HourlyRate:factor(OverTime)1 ***
factor(StockOptionLevel).L:TotalWorkingYears
factor(StockOptionLevel).Q:TotalWorkingYears **
factor(StockOptionLevel).C:TotalWorkingYears **
factor(StockOptionLevel).L:TrainingTimesLastYear
factor(StockOptionLevel).Q:TrainingTimesLastYear
factor(StockOptionLevel).C:TrainingTimesLastYear .
TotalWorkingYears:TrainingTimesLastYear
PercentSalaryHike:YearsAtCompany
PercentSalaryHike:YearsSinceLastPromotion
YearsAtCompany:YearsSinceLastPromotion
PercentSalaryHike:YearsWithCurrManager *
YearsAtCompany:YearsWithCurrManager
YearsSinceLastPromotion:YearsWithCurrManager .
factor(BusinessTravel)Travel_Frequently:DistanceFromHome:factor(MaritalStatus)Married
factor(BusinessTravel)Travel_Rarely:DistanceFromHome:factor(MaritalStatus)Married
factor(BusinessTravel)Travel_Frequently:DistanceFromHome:factor(MaritalStatus)Single
factor(BusinessTravel)Travel_Rarely:DistanceFromHome:factor(MaritalStatus)Single
factor(BusinessTravel)Travel_Frequently:DistanceFromHome:factor(WorkLifeBalance).L
factor(BusinessTravel)Travel_Rarely:DistanceFromHome:factor(WorkLifeBalance).L
factor(BusinessTravel)Travel_Frequently:DistanceFromHome:factor(WorkLifeBalance).Q
factor(BusinessTravel)Travel_Rarely:DistanceFromHome:factor(WorkLifeBalance).Q
factor(BusinessTravel)Travel_Frequently:DistanceFromHome:factor(WorkLifeBalance).C
factor(BusinessTravel)Travel_Rarely:DistanceFromHome:factor(WorkLifeBalance).C
factor(BusinessTravel)Travel_Frequently:factor(MaritalStatus)Married:factor(WorkLifeBalance).L
factor(BusinessTravel)Travel_Rarely:factor(MaritalStatus)Married:factor(WorkLifeBalance).L
[ reached getOption("max.print") -- omitted 97 rows ]
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 4154.4 on 2999 degrees of freedom
Residual deviance: 945.9 on 2709 degrees of freedom
AIC: 1527.9
Number of Fisher Scoring iterations: 21
AIC(logmod)
[1] 1527.899
BIC(logmod)
[1] 3275.752
Odds Ratios You can also exponentiate the coefficients and interpret them as odds-ratios.
ln a P(Attrition=1)/P(Attrition=0)
R will do this computation for you. To get the exponentiated coefficients, you tell R that you want to exponentiate (exp), and that the object you want to exponentiate is called coefficients and it is part of mylogit (coef(logmod)). We can use the same logic to get odds ratios and their confidence intervals, by exponentiating the confidence intervals from before. To put it all in one table, we use cbind to bind the coefficients and confidence intervals column-wise.
#cbind(exp.coef=exp(logmod$coef),exp(confint(logmod)))
If we use R’s diagnostic plot, the first one is the scatterplot of the residuals, against predicted values (the score actually).
plot(logmod,which=1)
plot(predict(logmod),residuals(logmod))
abline(h=0,lty=2,col="grey")
H0:βj=0 (Xj has no effect on P(Y=1)) vs
Ha:βj≠0
Test statistic:
z=bj/se(bj)
this is approximately N(0,1) under H0
Attrition Example: #fitting the logistic model
#summary(logmod)
H0:βp−k+1=⋯=βp=0 reduced model
Ha: full model ( all variables in the model)
This is likelihood ratio test that compares the log likelihoods of the two models
Λ=2 ln L(Full model)/L(Reduced model)
Asymptotically, Λ has a Chi-square distribution. Thus the test statistics is aproximate Chi-square.
Test statistic:
χ2=2 log L(Full model) − 2 log L(Reduced model)
where L()= the likelihood function
Under the null hypothesis, the test statistic is approximately Chi-squared with df=k (number of additional variables in the full model)
The Deviance of a model is
Deviance = D = −2 log L(model)
So, the tests statistic for the above situation is
χ2=D(Reduced model)−D(Full model)
H0: reduced model = no variables (only intercept) β1=⋯βp=0 This is the NULL model
Ha: full model (all variables in the model)
Test statistic:
Deviance= χ^2=-2 log L(reduced)/L(full) = D(reduced)-D(full)
Approximately χ2 with df=n−p
anova(logmod)
glm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: algorithm did not convergeglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: algorithm did not convergeglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurred
Analysis of Deviance Table
Model: binomial, link: logit
Response: factor(Attrition)
Terms added sequentially (first to last)
Df Deviance Resid. Df Resid. Dev
NULL 2999 4154.4
Age 1 130.4 2998 4024.0
factor(BusinessTravel) 2 74.9 2996 3949.2
DistanceFromHome 1 43.2 2995 3905.9
factor(MaritalStatus) 2 120.7 2993 3785.2
factor(WorkLifeBalance) 3 50.8 2990 3734.4
DailyRate 1 5.4 2989 3729.0
factor(Department) 2 41.6 2987 3687.4
factor(Education) 4 8.0 2983 3679.3
EducationField 5 71.1 2978 3608.2
factor(JobInvolvement) 3 109.9 2975 3498.4
factor(JobLevel) 4 263.6 2971 3234.8
factor(JobSatisfaction) 3 65.4 2968 3169.4
factor(EnvironmentSatisfaction) 3 73.4 2965 3096.0
factor(Gender) 1 8.2 2964 3087.8
factor(JobRole) 8 76.8 2956 3010.9
MonthlyIncome 1 0.8 2955 3010.2
HourlyRate 1 2.0 2954 3008.2
factor(OverTime) 1 346.0 2953 2662.2
NumCompaniesWorked 1 73.5 2952 2588.7
factor(PerformanceRating) 1 0.4 2951 2588.3
factor(RelationshipSatisfaction) 3 43.1 2948 2545.2
factor(StockOptionLevel) 3 33.9 2945 2511.2
TotalWorkingYears 1 0.9 2944 2510.3
TrainingTimesLastYear 1 15.2 2943 2495.1
PercentSalaryHike 1 12.4 2942 2482.7
YearsAtCompany 1 8.1 2941 2474.6
YearsSinceLastPromotion 1 22.3 2940 2452.4
YearsWithCurrManager 1 107.7 2939 2344.7
factor(BusinessTravel):DistanceFromHome 2 19.6 2937 2325.1
factor(BusinessTravel):factor(MaritalStatus) 4 37.8 2933 2287.3
DistanceFromHome:factor(MaritalStatus) 2 1.3 2931 2286.1
factor(BusinessTravel):factor(WorkLifeBalance) 6 24.0 2925 2262.1
DistanceFromHome:factor(WorkLifeBalance) 3 10.4 2922 2251.7
factor(MaritalStatus):factor(WorkLifeBalance) 6 21.3 2916 2230.4
factor(Education):EducationField 20 137.6 2896 2092.9
factor(JobInvolvement):factor(JobLevel) 12 73.4 2884 2019.5
factor(JobInvolvement):factor(JobSatisfaction) 9 40.7 2875 1978.8
factor(JobLevel):factor(JobSatisfaction) 12 79.2 2863 1899.6
factor(EnvironmentSatisfaction):factor(Gender) 3 5.9 2860 1893.7
factor(EnvironmentSatisfaction):factor(JobRole) 24 109.4 2836 1784.3
factor(Gender):factor(JobRole) 8 56.4 2828 1727.8
MonthlyIncome:HourlyRate 1 11.2 2827 1716.7
MonthlyIncome:factor(OverTime) 1 5.0 2826 1711.6
HourlyRate:factor(OverTime) 1 1.1 2825 1710.6
factor(StockOptionLevel):TotalWorkingYears 3 47.5 2822 1663.1
factor(StockOptionLevel):TrainingTimesLastYear 3 37.3 2819 1625.8
TotalWorkingYears:TrainingTimesLastYear 1 0.8 2818 1625.0
PercentSalaryHike:YearsAtCompany 1 4.0 2817 1621.0
PercentSalaryHike:YearsSinceLastPromotion 1 3.0 2816 1618.0
YearsAtCompany:YearsSinceLastPromotion 1 21.2 2815 1596.8
PercentSalaryHike:YearsWithCurrManager 1 1.2 2814 1595.5
YearsAtCompany:YearsWithCurrManager 1 15.0 2813 1580.6
YearsSinceLastPromotion:YearsWithCurrManager 1 30.9 2812 1549.7
factor(BusinessTravel):DistanceFromHome:factor(MaritalStatus) 4 21.3 2808 1528.4
factor(BusinessTravel):DistanceFromHome:factor(WorkLifeBalance) 6 40.7 2802 1487.7
factor(BusinessTravel):factor(MaritalStatus):factor(WorkLifeBalance) 12 95.3 2790 1392.4
DistanceFromHome:factor(MaritalStatus):factor(WorkLifeBalance) 6 39.0 2784 1353.4
factor(JobInvolvement):factor(JobLevel):factor(JobSatisfaction) 31 0.0 2753 25446.8
factor(EnvironmentSatisfaction):factor(Gender):factor(JobRole) 24 24370.8 2729 1076.0
MonthlyIncome:HourlyRate:factor(OverTime) 1 0.0 2728 24005.1
factor(StockOptionLevel):TotalWorkingYears:TrainingTimesLastYear 3 22997.8 2725 1007.3
PercentSalaryHike:YearsAtCompany:YearsSinceLastPromotion 1 5.4 2724 1001.9
PercentSalaryHike:YearsAtCompany:YearsWithCurrManager 1 0.9 2723 1001.0
PercentSalaryHike:YearsSinceLastPromotion:YearsWithCurrManager 1 1.7 2722 999.4
YearsAtCompany:YearsSinceLastPromotion:YearsWithCurrManager 1 24.1 2721 975.3
factor(BusinessTravel):DistanceFromHome:factor(MaritalStatus):factor(WorkLifeBalance) 11 29.3 2710 946.0
PercentSalaryHike:YearsAtCompany:YearsSinceLastPromotion:YearsWithCurrManager 1 0.1 2709 945.9
ll.null <- logmod$null.deviance/-2
ll.proposed <- logmod$deviance/-2
ll.null
[1] -2077.198
ll.proposed
[1] -472.9497
(ll.null - ll.proposed) / ll.null
[1] 0.7723137
1 - pchisq(2*(ll.proposed - ll.null), df=(length(logmod$coefficients)-1))
[1] 0
This means that the model with our regressors and interactions in it is better than the model with no variables.
predicted.data <- data.frame(
probability.of.Attrition=logmod$fitted.values,
Attrition=data$Attrition)
predicted.data <- predicted.data[order(predicted.data$probability.of.Attrition, decreasing=FALSE),]
predicted.data$rank <- 1:nrow(predicted.data)
summary(predicted.data)
probability.of.Attrition Attrition rank
Min. :0.0000000 0:1558 Min. : 1.0
1st Qu.:0.0000474 1:1442 1st Qu.: 750.8
Median :0.4753597 Median :1500.5
Mean :0.4806667 Mean :1500.5
3rd Qu.:0.9801070 3rd Qu.:2250.2
Max. :1.0000000 Max. :3000.0
## Lastly, we can plot the predicted probabilities for each sample having
## heart disease and color by whether or not they actually had heart disease
ggplot(data=predicted.data, aes(x=rank, y=probability.of.Attrition)) +
geom_point(aes(color=Attrition), alpha=1, shape=4, stroke=2) +
xlab("Index") +
ylab("Predicted probability of Attrition")
ggsave("attrition_probabilities.pdf")
Saving 7.29 x 4.51 in image
Predicted values (Y vs observations that were classified as positive Y^=1, or negative Y^=0, at a threshold of .45.
S<-predict(logmod,type="response")
Y<-data$Attrition
Ps=(S>.45)*1
rbind(c("","Y^=1", "Y^=0"),
c("Y=1", sum((Ps==1)*(Y==1)), sum((Ps!=1)*(Y==1))),
c("Y=0", sum((Ps==1)*(Y==0)), sum((Ps!=1)*(Y==0))))
[,1] [,2] [,3]
[1,] "" "Y^=1" "Y^=0"
[2,] "Y=1" "1403" "39"
[3,] "Y=0" "113" "1445"
There are number of methods of evaluating whether a logistic model is a good model. One such way is sensitivity and specificity.
Sensitivity and specificity are statistical measures of the performance of a binary classification test, also known in statistics as classification function:
Sensitivity (also called the true positive rate, or the recall in some fields) measures the proportion of actual positives which are correctly identified as such (e.g., the percentage of sick people who are correctly identified as having the condition), and is complementary to the false negative rate. Sensitivity= true positives/(true positive + false negative)
Specificity (also called the true negative rate) measures the proportion of negatives which are correctly identified as such (e.g., the percentage of healthy people who are correctly identified as not having the condition), and is complementary to the false positive rate. Specificity=true negatives/(true negative + false positives)
FP=sum((Ps==1)*(Y==0)) #false positives
TP=sum((Ps==1)*(Y==1)) #true positives
FN=sum((Ps!=1)*(Y==1)) #false neagtive
TN=sum((Ps!=1)*(Y==0)) #true negative
TP/(TP+FN)
[1] 0.9729542
TN/(TN+FP)
[1] 0.9274711
sum((Ps==1)*(Y==0))/sum(Y==0) #false positives
[1] 0.07252888
sum((Ps==1)*(Y==1))/sum(Y==1) #true positives
[1] 0.9729542
Additionally, there are four other important metrics - AIC, AICc, BIC and Mallows Cp - that are commonly used for model evaluation and selection. These are an unbiased estimate of the model prediction error MSE. The lower these metrics, the better the model.
AIC stands for (Akaike’s Information Criteria), a metric developped by the Japanese Statistician, Hirotugu Akaike, 1970. The basic idea of AIC is to penalize the inclusion of additional variables to a model. It adds a penalty that increases the error when including additional terms. The lower the AIC, the better the model.
AIC(logmod)
[1] 1527.899
AICc is a version of AIC corrected for small sample sizes.
BIC (or Bayesian information criteria) is a variant of AIC with a stronger penalty for including additional variables to the model.
BIC(logmod)
We used several techniques to build a robust Logistic Regression model to predict Attrition of an employee at a given company.
First, we loaded the data into R Studio. Then we converted all variables to factors taking into consideration specific variables that are ordinal in nature.
After summarizing and visualizing our data regressors with respect to Attrition using various common libraries and techniques, we discovered that our Attrition response variable had a minority value of 1 resulting in a significantly unbalanced dataset. If not treated properly, our model would more frequently predict 0. Therefore, we used a common under/over sampling technique to balance our dataset.
We then spent a significant amount of time looking at all of the 35 regressors using our intuition and emperical analysis to determine those variables that had significant interactions. Our primary heuristic used to gague a better model was by minimizing our AIC as we adjusted various interactions within the model. The end result was a pseudo-adjusted R2 value of 0.77 and a p-value of 0 indicating a good model.
We then computed the confusion matrix of our model which consisted of our precision and sensitivity corresponding to our true positive and true negative rates, respectively. Our recall was 0.97 where we predicted 97% of all True Positive samples correctly and we predicted 93% of all True Negative samples correctly.
Finally, we plotted our 3000 predicted values which resulted in an S shaped curve which is to be expected for a Logistic Regression model with a large number of samples.
Overall, we are very pleased with the outcome of our model. Our model showed several features that played a significant role in building a more robust model.
For example, the following interactions we used in our model make intuitive sense:
One interpretation for this is that married employees with a family that have a bad work/life balance could lead to attrition as they seek positions that offer a better work/life balance. Conversely, this could also indicate that they stay because the employer values a work/life balance.
If you are not involved in your job, you may not be satisfied.
If you are not happy in your environment due to various social reasons based on say gender imbalance, for example, this can be a key motivator to leave.
Sometimes employees that feel they should make more will leave for higher wages. Likewise, if you get a lot of overtime, this can typically be a positive aspect for some.
The longer you work at a company, the more stock options you are able to obtain. Likewise, if you are not able to receive training, you may become stagnant or bored doing the same thing over and over again.
Again, depending on how long you have worked at a company, these interactions can lead to leaving if your manager is very bad or they could stay of their manager is great and they stay with the same manager for a long time. Often if you get a long with your manager, the relationship gets better over time.